code: def create_sinusoidal_positions(num_pos: int, dim: int) -> tf.Tensor:
      inv_freq = tf.cast(
          1.0 / (10000 ** (tf.range(0, dim, 2) / dim)), tf.float32
      )
      sinusoid_inp = tf.cast(
          tf.einsum(
              "i , j -> i j",
              tf.range(num_pos, dtype=tf.float32),
              inv_freq,
          ),
          tf.float32,
      )
      sin, cos = tf.sin(sinusoid_inp), tf.cos(sinusoid_inp)
      out = tf.concat((sin, cos), axis=1)
      return out
  
imports: from typing import Optional, Tuple, Union
  import numpy
  import tensorflow
  from ...activations_tf import get_tf_activation
  from ...file_utils import DUMMY_INPUTS, add_code_sample_docstrings, add_start_docstrings, add_start_docstrings_to_model_forward
  from ...modeling_tf_outputs import TFBaseModelOutputWithPast, TFCausalLMOutputWithPast, TFQuestionAnsweringModelOutput, TFSequenceClassifierOutputWithPast
  from ...modeling_tf_utils import TFCausalLanguageModelingLoss, TFModelInputType, TFPreTrainedModel, TFQuestionAnsweringLoss, TFSequenceClassificationLoss, TFSharedEmbeddings, get_initializer, keras_serializable, unpack_inputs
  from ...tf_utils import shape_list, stable_softmax
  from ...utils import logging
  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: out