code: def _create_cos_sin(inv_freq, max_position_embeddings, dtype, device):
      t = torch.arange(
          max_position_embeddings,
          device=inv_freq.device,
          dtype=inv_freq.dtype,
      )
      freqs = torch.einsum("i,j->ij", t, inv_freq)
      # Different from paper, but it uses a different permutation in order to obtain the same calculation
      emb = torch.cat((freqs, freqs), dim=-1)
      return emb.cos().to(device).to(dtype), emb.sin().to(device).to(
          dtype
      )
  
imports: from typing import Optional, Tuple, Union
  import os
  import torch
  import torch.distributed
  import torch.utils.checkpoint
  from torch import nn
  from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
  from transformers.activations import ACT2FN
  from transformers.file_utils import add_code_sample_docstrings, add_start_docstrings, add_start_docstrings_to_model_forward, replace_return_docstrings
  from transformers.modeling_outputs import BaseModelOutputWithPast, CausalLMOutputWithPast, QuestionAnsweringModelOutput, SequenceClassifierOutputWithPast, TokenClassifierOutput
  from transformers.modeling_utils import PreTrainedModel
  from transformers import GPTNeoXConfig
  from loguru import logger
  from text_generation_server.utils.layers import TensorParallelColumnLinear, TensorParallelEmbedding, TensorParallelRowLinear, TensorParallelHead
label_desc: Use image node_id 3 for calling the RotaryEmbedding obj's underlying member method code with example usage: obj._create_cos_sin(inv_freq, max_position_embeddings, dtype, device) and returns: emb,  emb