code: def apply_rotary_pos_emb(x, sin, cos, scale=1):
      sin, cos = map(
          lambda t: duplicate_interleave(t * scale), (sin, cos)
      )
      # einsum notation for lambda t: repeat(t[offset:x.shape[1]+offset,:], "n d -> () n () (d j)", j=2)
      return (x * cos) + (rotate_every_two(x) * sin)
  
file_path: NeMo/nemo/collections/nlp/modules/common/megatron/position_embedding/xpos_position_embedding.py
imports: import torch
  import torch.nn
  from einops import rearrange
  from nemo.utils.decorators import experimental
label_desc: Use image node_id 4 for calling a global function with example usage: apply_rotary_pos_emb(x, sin, cos, scale) and returns: unknown