class_docstr: Fixed positional encoding (embedding layer) from sine and cosine functions
  of different frequencies according to https://arxiv.org/abs/1706.03762
  
  Args:
      hidden_size: size of the embeddings in the model, also known as d_model
      max_sequence_length: maximum allowed length of the input sequence
class_docstr_tok: ["Fixed","positional","encoding","(","embedding","layer",")","from","sine","and","cosine","functions","of","different","frequencies","according","to","https",":","\/\/arxiv.org\/abs\/1706.03762","Args",":","hidden_size",":","size","of","the","embeddings","in","the","model",",","also","known","as","d_model","max_sequence_length",":","maximum","allowed","length","of","the","input","sequence"]
code: def forward(self, position_ids):
      max_pos_id = position_ids.max()
      # update positional encoding if needed
      if max_pos_id >= self._max_sequence_length:
          logging.warning(
              f"Max position id {max_pos_id} is greater than max sequence length {self._max_sequence_length}. Expanding position embeddings just for this batch. This is not expected to work very well. Consider chunking your input into smaller sequences."
          )
          self._build_pos_enc(
              hidden_size=self._hidden_size,
              max_sequence_length=max_pos_id + 1,
              device=position_ids.device,
          )
  
      embeddings = torch.embedding(self.pos_enc, position_ids)
  
      # Revert expansion of position embeddings since this wall checkpoint size mismatches.
      if max_pos_id >= self._max_sequence_length:
          self._build_pos_enc(
              hidden_size=self._hidden_size,
              max_sequence_length=self._max_sequence_length,
              device=position_ids.device,
          )
      return embeddings
  
imports: import math
  import numpy
  import torch
  from torch import nn
  from torch.nn.functional import gelu
  from nemo.collections.common.parts import form_attention_mask
  from nemo.utils import logging
label_desc: Use image node_id 3 for calling the FixedPositionalEncoding obj's underlying member method code with example usage: obj.forward(position_ids) and returns: embeddings