code: def apply_rotary_pos_emb(t, freqs):
      cos, sin = freqs
      rot_dim = freqs[0].shape[-1]
      t_, t_pass_ = t[..., :rot_dim], t[..., rot_dim:]
      t_ = t_.float()
      t_pass_ = t_pass_.float()
      t_ = (t_ * cos) + (rotate_half(t_) * sin)
      return torch.cat((t_, t_pass_), dim=-1).type_as(t)
  
file_path: BigDL/python/llm/src/bigdl/llm/transformers/models/qwen_vl.py
imports: import importlib
  import math
  from typing import TYPE_CHECKING, Optional, Tuple, Union, Callable, List
  import torch
  import torch.nn.functional
  import torch.utils.checkpoint
  from transformers.utils import logging
  from bigdl.llm.transformers.models.utils import extend_kv_cache, init_kv_cache, append_kv_cache
  from bigdl.llm.transformers.models.utils import rotate_half
label_desc: Use image node_id 1 for calling a global function with example usage: apply_rotary_pos_emb(t, freqs) and returns: torch