class_docstr: Embedding from token and position embeddings.
  Optionally add token_type embedding (e.g. type of the sentence in BERT).
  
  Args:
      vocab_size: size of the vocabulary
      hidden_size: size of the embeddings in the model, also known as d_model
      max_sequence_length: maximum allowed length of the input sequence
      num_token_types: number of different token types
          (e.g. tokens of sentence A and tokens of sentence B in BERT)
      embedding_dropout: probability of dropout applied to embeddings
      learn_positional_encodings: whether to learn positional encodings or
          use fixed (sine-cosine) ones
class_docstr_tok: ["Embedding","from","token","and","position","embeddings",".","Optionally","add","token_type","embedding","(","e.g",".","type","of","the","sentence","in","BERT",")",".","Args",":","vocab_size",":","size","of","the","vocabulary","hidden_size",":","size","of","the","embeddings","in","the","model",",","also","known","as","d_model","max_sequence_length",":","maximum","allowed","length","of","the","input","sequence","num_token_types",":","number","of","different","token","types","(","e.g",".","tokens","of","sentence","A","and","tokens","of","sentence","B","in","BERT",")","embedding_dropout",":","probability","of","dropout","applied","to","embeddings","learn_positional_encodings",":","whether","to","learn","positional","encodings","or","use","fixed","(","sine-cosine",")","ones"]
code: def forward(self, input_ids, token_type_ids=None, start_pos=0):
      seq_length = input_ids.size(1)
      # we fail here only with parametric positional embedding. FixedPositionalEncoding automatically extends.
      if self.learn_positional_encodings and (
          seq_length > self.max_sequence_length
      ):
          raise ValueError(
              f"Input sequence is longer than maximum allowed sequence length for positional encoding. "
              f"Got {seq_length} and {self.max_sequence_length}"
          )
      position_ids = torch.arange(
          start=start_pos,
          end=start_pos + seq_length,
          dtype=torch.long,
          device=input_ids.device,
      )
      position_ids = position_ids.unsqueeze(0).repeat(
          input_ids.size(0), 1
      )
  
      token_embeddings = self.token_embedding(input_ids)
      position_embeddings = self.position_embedding(position_ids)
      embeddings = token_embeddings + position_embeddings
  
      if token_type_ids is not None:
          token_type_embeddings = self.token_type_embedding(
              token_type_ids
          )
          embeddings = embeddings + token_type_embeddings
  
      embeddings = self.layer_norm(embeddings)
      embeddings = self.dropout(embeddings)
  
      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 2 for calling the TransformerEmbedding obj's underlying member method code with example usage: obj.forward(input_ids, token_type_ids, start_pos) and returns: embeddings