code: def _compute_dec_mask(self, tgt_pad_mask, future):
      tgt_len = tgt_pad_mask.size(-1)
      if not future:
          # Add triangular future_mask and pad_mask, result mask in (B, T, T).
          future_mask = torch.ones(
              [tgt_len, tgt_len],
              device=tgt_pad_mask.device,
              dtype=torch.uint8,
          )
          future_mask = future_mask.tril_(0)
          if self.sliding_window > 0:
              future_mask = future_mask.triu_(-self.sliding_window)
          future_mask = future_mask.bool()
          future_mask = ~future_mask.view(1, tgt_len, tgt_len)
          # Patch for scaled dot product attention.
          patch_mask = ~torch.all(
              tgt_pad_mask + future_mask, dim=2, keepdim=True
          ).expand_as(tgt_pad_mask + future_mask)
          dec_mask = torch.gt(tgt_pad_mask + future_mask, 0)
          dec_mask = torch.logical_and(dec_mask, patch_mask)
      else:
          # Only mask padding, result mask in (B, 1, T).
          dec_mask = tgt_pad_mask
      return dec_mask
  
imports: import torch
  import torch.nn
  from onmt.decoders.decoder import DecoderBase
  from onmt.modules import MultiHeadedAttention, AverageAttention
  from onmt.modules.position_ffn import PositionwiseFeedForward
  from onmt.modules.position_ffn import ActivationFunction
  from onmt.modules.moe import MoE
  from onmt.utils.misc import sequence_mask
  from onmt.modules.rmsnorm import RMSNorm
label_desc: Use image node_id 5 for calling the TransformerDecoderLayerBase obj's underlying member method code with example usage: obj._compute_dec_mask(tgt_pad_mask, future) and returns: dec_mask