class_docstr: TransformerDecoder class.
  Args:
      decoder_layer (nn.Module): dencoder module
      num_layers (int): number of layers
class_docstr_tok: ["TransformerDecoder","class",".","Args",":","decoder_layer","(","nn.Module",")",":","dencoder","module","num_layers","(","int",")",":","number","of","layers"]
code: def forward(
      self,
      tgt,
      memory,
      tgt_mask: Optional[Tensor] = None,
      memory_mask: Optional[Tensor] = None,
      tgt_key_padding_mask: Optional[Tensor] = None,
      memory_key_padding_mask: Optional[Tensor] = None,
      pos: Optional[Tensor] = None,
      query_pos: Optional[Tensor] = None,
  ):
      output = tgt
  
      for layer in self.layers:
          output = layer(
              output,
              memory,
              tgt_mask=tgt_mask,
              memory_mask=memory_mask,
              tgt_key_padding_mask=tgt_key_padding_mask,
              memory_key_padding_mask=memory_key_padding_mask,
              pos=pos,
              query_pos=query_pos,
          )
  
      return output.unsqueeze(0)
  
imports: import copy
  import torch
  import torch.nn.functional
  from typing import Optional
  from torch import nn, Tensor
label_desc: Use image node_id 2 for calling the TransformerDecoder obj's underlying member method code with example usage: obj.forward(tgt, memory, tgt_mask, memory_mask, tgt_key_padding_mask, memory_key_padding_mask, pos, query_pos) and returns: output