class_docstr: Cloze-Transformer decoder.
class_docstr_tok: ["Cloze-Transformer","decoder","."]
docstr: attend all surounding words except itself
     [[0, -inf, 0]
      [0,  0, -inf]
      [0,  0,   0]]
  The attention map is not ture diagonal since we predict y_{t+1} at time-step t
docstr_tok: ["attend","all","surounding","words","except","itself","[","[","0",",","-inf",",","0","]","[","0",",","0",",","-inf","]","[","0",",","0",",","0","]","]","The","attention","map","is","not","ture","diagonal","since","we","predict","y_","{","t+1","}","at","time-step","t"]
code: def buffered_future_mask(self, tensor):
      """attend all surounding words except itself
         [[0, -inf, 0]
          [0,  0, -inf]
          [0,  0,   0]]
      The attention map is not ture diagonal since we predict y_{t+1} at time-step t
      """
      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
          )
          self._future_mask = torch.tril(self._future_mask, 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,
          )
          self._future_mask = torch.tril(self._future_mask, 1)
      return self._future_mask[:dim, :dim]
  
file_path: translate/pytorch_translate/research/rescore/cloze_transformer_model.py
imports: import torch
  from fairseq import utils
  from fairseq.models import register_model, register_model_architecture
  from pytorch_translate.transformer import base_architecture, build_embedding, TransformerDecoder, TransformerModel
label_desc: Use image node_id 2 for calling the ClozeTransformerDecoder obj's underlying member method code with example usage: obj.buffered_future_mask(tensor) and returns: self