code: def fixed_pos_embedding(x, seq_dim=1, seq_len=None):
      dim = x.shape[-1]
      if seq_len is None:
          seq_len = x.shape[seq_dim]
      inv_freq = 1.0 / (10000 ** (torch.arange(0, dim, 2) / dim))
      sinusoid_inp = (
          torch.einsum(
              "i , j -> i j",
              torch.arange(seq_len, dtype=torch.float),
              inv_freq,
          )
          .to(x.device)
          .float()
      )
      return torch.sin(sinusoid_inp), torch.cos(sinusoid_inp)
  
imports: from typing import Optional, Tuple, Union
  import torch
  import torch.utils.checkpoint
  from torch import nn
  from torch.nn import CrossEntropyLoss
  from ...activations import ACT2FN
  from ...modeling_outputs import BaseModelOutputWithPast, CausalLMOutputWithPast
  from ...modeling_utils import PreTrainedModel
  from ...utils import add_code_sample_docstrings, add_start_docstrings, add_start_docstrings_to_model_forward, logging
  from .configuration_codegen import CodeGenConfig
label_desc: Use image node_id 1 for calling a global function with example usage: fixed_pos_embedding(x, seq_dim, seq_len) and returns: torch,  torch