class_docstr: TransformerDecoder layer which inherits from TransformerEncoderLayer.
class_docstr_tok: ["TransformerDecoder","layer","which","inherits","from","TransformerEncoderLayer","."]
code: def forward(self, src):
      # TODO(anj-s): Fix the data format so that we have [seq_len, batch_size, embedding dim].
      # Currently real data has seq_len as the second dimension and batch_size as the first dimension.
      # We need to mask the sequence length dimension and not the batch size.
      if self.src_mask is None or self.src_mask.size(0) != len(src):
          device = src.device
          mask = self._generate_square_subsequent_mask(len(src)).to(
              device
          )
          self.src_mask = mask
  
      return super().forward(src, self.src_mask)
  
imports: import math
  import torch
  import torch.nn
  from fairscale.nn.moe.moe_layer import MOELayer
  from fairscale.nn.moe.top2gate import Top2Gate
label_desc: Use image node_id 3 for calling the TransformerDecoderLayer obj's underlying member method code with example usage: obj.forward(src) and returns: super