class_docstr: Transformer decoder consisting of *config.decoder_layers* layers. Each layer is a [`WhisperDecoderLayer`]
  
  Args:
      config: WhisperConfig
class_docstr_tok: ["Transformer","decoder","consisting","of","*","config.decoder_layers","*","layers",".","Each","layer","is","a","[","`","WhisperDecoderLayer","`","]","Args",":","config",":","WhisperConfig"]
code: def _prepare_decoder_attention_mask(
      self,
      attention_mask,
      input_shape,
      inputs_embeds,
      past_key_values_length,
  ):
      # create causal mask
      # [bsz, seq_len] -> [bsz, 1, tgt_seq_len, src_seq_len]
      combined_attention_mask = None
  
      if input_shape[-1] > 1:
          combined_attention_mask = _make_causal_mask(
              input_shape,
              inputs_embeds.dtype,
              past_key_values_length=past_key_values_length,
          ).to(inputs_embeds.device)
  
      if attention_mask is not None:
          if attention_mask.shape[-1] > input_shape[-1] > 0:
              attention_mask = attention_mask[
                  :, : input_shape[-1] + past_key_values_length
              ]
          # [bsz, seq_len] -> [bsz, 1, tgt_seq_len, src_seq_len]
          expanded_attn_mask = _expand_mask(
              attention_mask,
              inputs_embeds.dtype,
              tgt_len=input_shape[-1],
          )
          combined_attention_mask = (
              expanded_attn_mask
              if combined_attention_mask is None
              else expanded_attn_mask + combined_attention_mask
          )
  
      return combined_attention_mask
  
imports: import math
  import random
  from typing import Optional, Tuple
  import torch
  import torch.utils.checkpoint
  from torch import nn
  from torch.nn import CrossEntropyLoss
  from ...activations import ACT2FN
  from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, Seq2SeqLMOutput, Seq2SeqModelOutput
  from ...modeling_utils import PreTrainedModel
  from ...utils import add_start_docstrings, add_start_docstrings_to_model_forward, logging, replace_return_docstrings
  from .configuration_whisper import WhisperConfig
label_desc: Use image node_id 4 for calling the WhisperDecoder obj's underlying member method code with example usage: obj._prepare_decoder_attention_mask(attention_mask, input_shape, inputs_embeds, past_key_values_length) and returns: combined_attention_mask