class_docstr: This module learns positional embeddings up to a fixed maximum size.
  Padding ids are ignored by either offsetting based on padding_idx
  or by setting padding_idx to None and ensuring that the appropriate
  position ids are passed to the forward function.
class_docstr_tok: ["This","module","learns","positional","embeddings","up","to","a","fixed","maximum","size",".","Padding","ids","are","ignored","by","either","offsetting","based","on","padding_idx","or","by","setting","padding_idx","to","None","and","ensuring","that","the","appropriate","position","ids","are","passed","to","the","forward","function","."]
code: def __init__(
      self, num_embeddings: int, embedding_dim: int, padding_idx: int
  ):
      super().__init__(num_embeddings, embedding_dim, padding_idx)
      if self.padding_idx is not None:
          self.max_positions = (
              self.num_embeddings - self.padding_idx - 1
          )
      else:
          self.max_positions = self.num_embeddings
  
imports: import math
  from enum import Enum
  from typing import Dict, Optional
  import torch
  import torch.nn
  import torch.nn.functional
  from pytext.models.representations.transformer import PositionalEmbedding
  from pytext.models.seq_models.base import PlaceholderIdentity
  from torch import Tensor
  from .utils import make_positions
label_desc: Use image node_id 1 to create a new LearnedPositionalEmbedding object from inherited base classes: nn with example: obj = LearnedPositionalEmbedding(num_embeddings, embedding_dim, padding_idx)