code: def apply_rotary_pos_emb(x, sincos, offset=0):
      sin, cos = map(
          lambda t: duplicate_interleave(t)[
              None, offset : x.shape[1] + offset, None, :
          ],
          sincos,
      )
      # 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)
  
imports: from typing import Optional, Tuple, Union
  import torch
  import torch.utils.checkpoint
  from torch import nn
  from torch.nn import CrossEntropyLoss
  from ...activations import ACT2FN
  from ...modeling_outputs import BaseModelOutputWithPast, CausalLMOutputWithPast
  from ...modeling_utils import PreTrainedModel
  from ...utils import add_code_sample_docstrings, add_start_docstrings, add_start_docstrings_to_model_forward, logging
  from .configuration_codegen import CodeGenConfig
label_desc: Use image node_id 4 for calling a global function with example usage: apply_rotary_pos_emb(x, sincos, offset) and returns: unknown