class_docstr: Inject some information about the relative or absolute position of the tokens
  in the sequence. The positional encodings have the same dimension as
  the embeddings, so that the two can be summed. Here, we use sine and cosine
  functions of different frequencies.
class_docstr_tok: ["Inject","some","information","about","the","relative","or","absolute","position","of","the","tokens","in","the","sequence",".","The","positional","encodings","have","the","same","dimension","as","the","embeddings",",","so","that","the","two","can","be","summed",".","Here",",","we","use","sine","and","cosine","functions","of","different","frequencies","."]
docstr: Inputs of forward function
  Args:
      x: the sequence fed to the positional encoder model (required).
  Shape:
      x: [batch size, sequence length, embed dim]
      output: [batch size, sequence length, embed dim]
  Examples:
      >>> output = pos_encoder(x)
docstr_tok: ["Inputs","of","forward","function","Args",":","x",":","the","sequence","fed","to","the","positional","encoder","model","(","required",")",".","Shape",":","x",":","[","batch","size",",","sequence","length",",","embed","dim","]","output",":","[","batch","size",",","sequence","length",",","embed","dim","]","Examples",":",">",">",">","output","=","pos_encoder","(","x",")"]
code: def forward(self, input_ids):
      r"""Inputs of forward function
      Args:
          x: the sequence fed to the positional encoder model (required).
      Shape:
          x: [batch size, sequence length, embed dim]
          output: [batch size, sequence length, embed dim]
      Examples:
          >>> output = pos_encoder(x)
      """
      return self.pe[:, : input_ids.shape[1], :]
  
imports: import torch
  import math
  from typing import Tuple
  from einops import repeat
label_desc: Use image node_id 2 for calling the SinusoidalPositional obj's underlying member method code with example usage: obj.forward(input_ids) and returns: self