class_docstr: Transformer decoder.
class_docstr_tok: ["Transformer","decoder","."]
code: def buffered_future_mask(self, tensor):
      dim = tensor.size(0)
      if (
          not hasattr(self, "_future_mask")
          or self._future_mask is None
          or self._future_mask.device != tensor.device
      ):
          self._future_mask = torch.triu(
              utils.fill_with_neg_inf(tensor.new(dim, dim)), 1
          )
      if self._future_mask.size(0) < dim:
          self._future_mask = torch.triu(
              utils.fill_with_neg_inf(
                  self._future_mask.resize_(dim, dim)
              ),
              1,
          )
      return self._future_mask[:dim, :dim]
  
imports: import math
  import random
  import torch
  import torch.nn
  import torch.nn.functional
  from fairseq import options, utils
  from fairseq.models import FairseqEncoder, FairseqEncoderDecoderModel, FairseqIncrementalDecoder, register_model, register_model_architecture, transformer
  from fairseq.modules import AdaptiveSoftmax, LayerNorm, MultiheadAttention, SinusoidalPositionalEmbedding
  from pytorch_translate import utils, vocab_reduction
  from pytorch_translate.average_attention import AverageAttention
  from pytorch_translate.common_layers import TransformerEmbedding, TransformerEncoderGivenEmbeddings, TransformerTokenEmbedding, VariableTracker
  from pytorch_translate.semi_supervised import SemiSupervisedModel
  from pytorch_translate.utils import torch_find
label_desc: Use image node_id 5 for calling the TransformerDecoder obj's underlying member method code with example usage: obj.buffered_future_mask(tensor) and returns: self