code: def _make_causal_mask(
      bsz: int,
      tgt_len: int,
      past_key_values_length: int,
      dtype: torch.dtype,
      device: torch.device,
  ):
      """
      Make causal mask used for bi-directional self-attention.
      """
      mask = torch.full(
          (tgt_len, tgt_len), torch.finfo(dtype).min, device=device
      )
      mask_cond = torch.arange(mask.size(-1), device=device)
      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,
                      device=device,
                  ),
                  mask,
              ],
              dim=-1,
          )
      return mask[None, None, :, :].expand(
          bsz, 1, tgt_len, tgt_len + past_key_values_length
      )
  
imports: import math
  from typing import Optional, Tuple
  import pdb
  import torch
  from torch import nn
  import torch.utils.checkpoint
  import torch.nn.functional
  from transformers.models.llama.modeling_llama import LlamaAttention, rotate_half, apply_rotary_pos_emb, LlamaRotaryEmbedding, apply_rotary_pos_emb, LlamaForCausalLM
  import types
  from transformers.configuration_utils import PretrainedConfig
label_desc: Use image node_id 2 for calling a global function with example usage: _make_causal_mask(bsz, tgt_len, past_key_values_length, dtype, device) and returns: mask