class_docstr: This module learns positional embeddings up to a fixed maximum size.
class_docstr_tok: ["This","module","learns","positional","embeddings","up","to","a","fixed","maximum","size","."]
code: def __init__(
      self, num_embeddings, embedding_dim, padding_idx, need_offset
  ):
      super().__init__(num_embeddings, embedding_dim)
      self.embedding_dim = embedding_dim
      self.padding_id = padding_idx
      self.offset = padding_idx + 1 if need_offset else 0
  
imports: import __init__
  import math
  import uuid
  from typing import Dict, Optional, List
  import torch
  from torch import Tensor, nn
  from torch.nn import Parameter, LayerNorm, Dropout
  from csrc.pytorch import util
  from csrc.pytorch.layer_base import TransformerEmbeddingLayerBase, TransformerEncoderLayerBase, TransformerDecoderLayerBase
  from csrc.pytorch.quantization import QuantLinear, TensorQuantizer, act_quant_config, weight_quant_config, out_quant_config, emb_quant_config
label_desc: Use image node_id 1 to create a new TrainablePositionalEmbedding object from inherited base classes: nn with example: obj = TrainablePositionalEmbedding(num_embeddings, embedding_dim, padding_idx, need_offset)