docstr: Args:
      hidden_states (`tf.Tensor`): input to the layer of shape `(seq_len, batch, embed_dim)`
      attention_mask (`tf.Tensor`, *optional*): attention mask of size
          `(batch, 1, tgt_len, src_len)` where padding elements are indicated by very large negative values.
      layer_head_mask (`tf.Tensor`, *optional*): mask for attention heads in a given layer of size
          `(decoder_attention_heads,)`
      past_key_value (`Tuple(tf.Tensor)`, *optional*): cached past key and value projection states
      training (`bool`, *optional*, defaults to `False`):
          Whether or not to use the model in training mode (some modules like dropout modules have different
          behaviors between training and evaluation).
docstr_tok: ["Args",":","hidden_states","(","`","tf.Tensor","`",")",":","input","to","the","layer","of","shape","`","(","seq_len",",","batch",",","embed_dim",")","`","attention_mask","(","`","tf.Tensor","`",",","*","optional","*",")",":","attention","mask","of","size","`","(","batch",",","1",",","tgt_len",",","src_len",")","`","where","padding","elements","are","indicated","by","very","large","negative","values",".","layer_head_mask","(","`","tf.Tensor","`",",","*","optional","*",")",":","mask","for","attention","heads","in","a","given","layer","of","size","`","(","decoder_attention_heads",",",")","`","past_key_value","(","`","Tuple","(","tf.Tensor",")","`",",","*","optional","*",")",":","cached","past","key","and","value","projection","states","training","(","`","bool","`",",","*","optional","*",",","defaults","to","`","False","`",")",":","Whether","or","not","to","use","the","model","in","training","mode","(","some","modules","like","dropout","modules","have","different","behaviors","between","training","and","evaluation",")","."]
code: def call(
      self,
      hidden_states: tf.Tensor,
      attention_mask: Optional[Union[np.ndarray, tf.Tensor]] = None,
      layer_head_mask: Optional[tf.Tensor] = None,
      past_key_value: Optional[
          Tuple[Tuple[Union[np.ndarray, tf.Tensor]]]
      ] = None,
      training: Optional[bool] = False,
      output_attentions: Optional[bool] = False,
      use_cache: Optional[bool] = False,
  ) -> Tuple[tf.Tensor, tf.Tensor, Tuple[Tuple[tf.Tensor]]]:
      """
      Args:
          hidden_states (`tf.Tensor`): input to the layer of shape `(seq_len, batch, embed_dim)`
          attention_mask (`tf.Tensor`, *optional*): attention mask of size
              `(batch, 1, tgt_len, src_len)` where padding elements are indicated by very large negative values.
          layer_head_mask (`tf.Tensor`, *optional*): mask for attention heads in a given layer of size
              `(decoder_attention_heads,)`
          past_key_value (`Tuple(tf.Tensor)`, *optional*): cached past key and value projection states
          training (`bool`, *optional*, defaults to `False`):
              Whether or not to use the model in training mode (some modules like dropout modules have different
              behaviors between training and evaluation).
      """
      residual = hidden_states
  
      # 125m, 1.7B, ..., 175B applies layer norm BEFORE attention
      if self.do_layer_norm_before:
          hidden_states = self.self_attn_layer_norm(hidden_states)
  
      # Self Attention
      # decoder uni-directional self-attention cached key/values tuple is at positions 1,2
      self_attn_past_key_value = (
          past_key_value[:2] if past_key_value is not None else None
      )
  
      # add present self-attn cache to positions 1,2 of present_key_value tuple
      (
          hidden_states,
          self_attn_weights,
          present_key_value,
      ) = self.self_attn(
          hidden_states=hidden_states,
          past_key_value=self_attn_past_key_value,
          attention_mask=attention_mask,
          layer_head_mask=layer_head_mask,
      )
      hidden_states = self.dropout(hidden_states, training=training)
      hidden_states = residual + hidden_states
  
      # 350m applies layer norm AFTER attention
      if not self.do_layer_norm_before:
          hidden_states = self.self_attn_layer_norm(hidden_states)
  
      # Fully Connected
      residual = hidden_states
      # 125m, 1.7B, ..., 175B applies layer norm BEFORE attention
      if self.do_layer_norm_before:
          hidden_states = self.final_layer_norm(hidden_states)
  
      hidden_states = self.fc1(hidden_states)
      hidden_states = self.activation_fn(hidden_states)
  
      hidden_states = self.fc2(hidden_states)
      hidden_states = self.dropout(hidden_states, training=training)
      hidden_states = residual + hidden_states
  
      # 350m applies layer norm AFTER attention
      if not self.do_layer_norm_before:
          hidden_states = self.final_layer_norm(hidden_states)
  
      return (hidden_states, self_attn_weights, present_key_value)
  
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 TFOPTDecoderLayer obj's underlying member method code with example usage: obj.call(hidden_states, attention_mask, layer_head_mask, past_key_value, training, output_attentions, use_cache) and returns: hidden_states,  self_attn_weights,  present_key_value