code: def create_sinusoidal_positions(
      num_pos: int, dim: int
  ) -> torch.Tensor:
      inv_freq = 1.0 / (10000 ** (torch.arange(0, dim, 2) / dim))
      sinusoid_inp = torch.einsum(
          "i , j -> i j",
          torch.arange(num_pos, dtype=torch.float),
          inv_freq,
      ).float()
      return torch.cat(
          (torch.sin(sinusoid_inp), torch.cos(sinusoid_inp)), dim=1
      )
  
imports: import warnings
  from typing import Optional, Tuple, Union
  import torch
  import torch.fx
  import torch.utils.checkpoint
  from torch import nn
  from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
  from ...activations import ACT2FN
  from ...modeling_outputs import BaseModelOutputWithPast, CausalLMOutputWithPast, QuestionAnsweringModelOutput, SequenceClassifierOutputWithPast
  from ...modeling_utils import PreTrainedModel
  from ...utils import add_code_sample_docstrings, add_start_docstrings, add_start_docstrings_to_model_forward, is_torch_fx_proxy, logging
  from ...utils.model_parallel_utils import assert_device_map, get_device_map
  from .configuration_gptj import GPTJConfig
label_desc: Use image node_id 1 for calling a global function with example usage: create_sinusoidal_positions(num_pos, dim) and returns: torch