class_docstr: Multi-headed attention from "Attention Is All You Need
code: def _shape(self, tensor: tf.Tensor, seq_len: int, bsz: int):
      return tf.transpose(
          tf.reshape(
              tensor, (bsz, seq_len, self.num_heads, self.head_dim)
          ),
          (0, 2, 1, 3),
      )
  
imports: import math
  import random
  from typing import Any, Optional, Tuple, Union
  import numpy
  import tensorflow
  from ...activations_tf import get_tf_activation
  from ...file_utils import DUMMY_INPUTS, add_code_sample_docstrings, add_start_docstrings, add_start_docstrings_to_model_forward, replace_return_docstrings
  from ...modeling_tf_outputs import TFBaseModelOutputWithPastAndCrossAttentions, TFCausalLMOutputWithCrossAttentions
  from ...modeling_tf_utils import TFCausalLanguageModelingLoss, TFModelInputType, TFPreTrainedModel, TFSharedEmbeddings, get_initializer, keras_serializable, unpack_inputs
  from ...tf_utils import shape_list, stable_softmax
  from ...utils import logging
  from .configuration_xglm import XGLMConfig
label_desc: Use image node_id 2 for calling the TFXGLMAttention obj's underlying member method code with example usage: obj._shape(tensor, seq_len, bsz) and returns: tf