code: def _make_causal_mask(
      input_ids_shape: torch.Size,
      dtype: torch.dtype,
      past_key_values_length: int = 0,
  ):
      """
      Make causal mask used for bi-directional self-attention.
      """
      bsz, tgt_len = input_ids_shape
      mask = torch.full(
          (tgt_len, tgt_len), torch.tensor(torch.finfo(dtype).min)
      )
      mask_cond = torch.arange(mask.size(-1))
      mask.masked_fill_(
          mask_cond < (mask_cond + 1).view(mask.size(-1), 1), 0
      )
      mask = mask.to(dtype)
  
      if past_key_values_length > 0:
          mask = torch.cat(
              [
                  torch.zeros(
                      tgt_len, past_key_values_length, dtype=dtype
                  ),
                  mask,
              ],
              dim=-1,
          )
      return mask[None, None, :, :].expand(
          bsz, 1, tgt_len, tgt_len + past_key_values_length
      )
  
imports: import math
  import random
  from typing import List, Optional, Tuple, Union
  import torch
  from torch import nn
  from torch.nn import CrossEntropyLoss
  from ...activations import ACT2FN
  from ...deepspeed import is_deepspeed_zero3_enabled
  from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, Seq2SeqLMOutput, Seq2SeqModelOutput
  from ...modeling_utils import PreTrainedModel
  from ...utils import add_code_sample_docstrings, add_end_docstrings, add_start_docstrings, add_start_docstrings_to_model_forward, logging, replace_return_docstrings
  from .configuration_m2m_100 import M2M100Config
label_desc: Use image node_id 2 for calling a global function with example usage: _make_causal_mask(input_ids_shape, dtype, past_key_values_length) and returns: mask