code: def fused_apply_rotary_pos_emb_cached(
      t: torch.Tensor,
      cos_: torch.Tensor,
      sin_: torch.Tensor,
      transpose_output_memory: bool = False,
  ) -> torch.Tensor:
      """Apply rotary positional embedding to input tensor T in `sbhd` format, where
      s: sequence length
      b: batch size
      h: head num
      d: dim of each head
  
      Args:
          t (Tensor): Input tensor T is of shape [s, b, h, d]
          cos_ (Tensor): Cached cosine of the rotary positional embedding tensor is of
          shape [s, 1, 1, d] and dtype either `float` or the same as `t`.
          sin_ (Tensor): Cached sine of the rotary positional embedding tensor is of
          shape [s, 1, 1, d] and dtype either `float` or the same as `t`.
          transpose_output_memory (bool): Default to False. Whether to transpose the 's' and 'b'
          dimension of the output's underlying memory format. This is very helpful when you want to
          get a contiguous tensor after calling `output.transpose(0, 1)`.
  
      Returns:
          Tensor: The input tensor after applying RoPE
      """
      return FusedRoPECachedFunc.apply(
          t, cos_, sin_, transpose_output_memory
      )
  
file_path: apex/apex/transformer/functional/fused_rope.py
imports: from typing import Tuple, Union
  import torch
label_desc: Use image node_id 2 for calling a global function with example usage: fused_apply_rotary_pos_emb_cached(t, cos_, sin_, transpose_output_memory) and returns: FusedRoPECachedFunc