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","."]
docstr: `input_ids_shape` is expected to be [bsz x seqlen].
docstr_tok: ["`","input_ids_shape","`","is","expected","to","be","[","bsz","x","seqlen","]","."]
code: def call(self, attention_mask, past_key_values_length: int = 0):
      """`input_ids_shape` is expected to be [bsz x seqlen]."""
      attention_mask = tf.cast(attention_mask, tf.int64)
  
      # create positions depending on attention_mask
      positions = (
          tf.math.cumsum(attention_mask, axis=1) * attention_mask - 1
      )
  
      # cut positions if `past_key_values_length` is > 0
      positions = positions[:, past_key_values_length:]
  
      return super().call(positions + self.offset)
  
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 2 for calling the TFOPTLearnedPositionalEmbedding obj's underlying member method code with example usage: obj.call(attention_mask, past_key_values_length) and returns: super