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: int, embedding_dim: int, **kwargs):
      # OPT is set up so that if padding_idx is specified then offset the embedding ids by 2
      # and adjust num_embeddings appropriately. Other models don't have this hack
      self.offset = 2
      super().__init__(
          num_embeddings + self.offset, embedding_dim, **kwargs
      )
  
imports: from typing import Optional, Tuple, Union
  import numpy
  import tensorflow
  from ...activations_tf import get_tf_activation
  from ...modeling_tf_outputs import TFBaseModelOutputWithPast, TFCausalLMOutputWithPast
  from ...modeling_tf_utils import DUMMY_INPUTS, TFCausalLanguageModelingLoss, TFModelInputType, TFPreTrainedModel, TFSharedEmbeddings, keras_serializable, unpack_inputs
  from ...tf_utils import shape_list, stable_softmax
  from ...utils import add_code_sample_docstrings, add_start_docstrings, add_start_docstrings_to_model_forward, logging, replace_return_docstrings
  from .configuration_opt import OPTConfig
label_desc: Use image node_id 1 to create a new TFOPTLearnedPositionalEmbedding object from inherited base classes: TFSharedEmbeddings with example: obj = TFOPTLearnedPositionalEmbedding(num_embeddings, embedding_dim)