docstr: If max_position_embeddings <= 0, there's no position embeddings
docstr_tok: ["If","max_position_embeddings","<","=","0",",","there","'s","no","position","embeddings"]
code: def __init__(
      self,
      embed_dim,
      vocab_size,
      max_position_embeddings,
      padding_idx=None,
  ):
      """
      If max_position_embeddings <= 0, there's no position embeddings
      """
      super().__init__()
      self.word_embeddings = nn.Embedding(
          vocab_size, embed_dim, padding_idx=padding_idx
      )
      self.max_position_embeddings = max_position_embeddings
      if self.max_position_embeddings > 0:
          self.position_embeddings = nn.Embedding(
              max_position_embeddings, embed_dim
          )
  
imports: import torch
  import torch.nn
  from einops import repeat
label_desc: Use image node_id 1 to create a new GPT2Embeddings object from inherited base classes: nn with example: obj = GPT2Embeddings(embed_dim, vocab_size, max_position_embeddings, padding_idx)