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"]
docstr: Builds/replaces pre-computed positional encoding.
docstr_tok: ["Builds\/replaces","pre-computed","positional","encoding","."]
code: def _build_pos_enc(
      self, hidden_size, max_sequence_length, device=None
  ):
      """
      Builds/replaces pre-computed positional encoding.
      """
      pos_enc = torch.zeros(
          max_sequence_length, hidden_size, device=device
      )
      position = torch.arange(0.0, max_sequence_length).unsqueeze(1)
      coef = -math.log(10000.0) / hidden_size
      div_term = torch.exp(coef * torch.arange(0.0, hidden_size, 2))
      pos_enc[:, 0::2] = torch.sin(position * div_term)
      pos_enc[:, 1::2] = torch.cos(position * div_term)
      pos_enc.div_(math.sqrt(hidden_size))
      self.register_buffer("pos_enc", pos_enc)
  
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 2 for calling the FixedPositionalEncoding obj's underlying member method code with example usage: obj._build_pos_enc(hidden_size, max_sequence_length, device) without return types