code: def _make_causal_mask(
      input_ids_shape: tf.TensorShape, past_key_values_length: int = 0
  ):
      """
      Make causal mask used for bi-directional self-attention.
      """
      bsz = input_ids_shape[0]
      tgt_len = input_ids_shape[1]
      mask = tf.ones((tgt_len, tgt_len)) * LARGE_NEGATIVE
      mask_cond = tf.range(shape_list(mask)[-1])
  
      mask = tf.where(
          mask_cond
          < tf.reshape(mask_cond + 1, (shape_list(mask)[-1], 1)),
          0.0,
          mask,
      )
  
      if past_key_values_length > 0:
          mask = tf.concat(
              [tf.zeros((tgt_len, past_key_values_length)), mask],
              axis=-1,
          )
  
      return tf.tile(mask[None, None, :, :], (bsz, 1, 1, 1))
  
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 4 for calling a global function with example usage: _make_causal_mask(input_ids_shape, past_key_values_length) and returns: tf