class_docstr: Transformer Decoder
class_docstr_tok: ["Transformer","Decoder"]
code: def forward(
      self,
      tgt: torch.Tensor,
      memory: torch.Tensor,
      source_mask: Optional[torch.Tensor] = None,
      target_mask: Optional[torch.Tensor] = None,
  ) -> torch.Tensor:
      tgt = self.embed(tgt) * math.sqrt(self.d_model)
      pos_enc_tgt = self.positional_encoding(tgt)
      output = pos_enc_tgt
  
      for i in range(self.num_layers):
          normed_output = self.layer_norm_input(output)
          output = output + self.dropout(
              self.attention[i](
                  normed_output,
                  normed_output,
                  normed_output,
                  target_mask,
              )
          )
          normed_output = self.layer_norm_masked_attention(output)
          output = output + self.dropout(
              self.source_attention[i](
                  normed_output, memory, memory, source_mask
              )
          )
          normed_output = self.layer_norm_attention(output)
          output = output + self.dropout(
              self.position_feed_forward[i](normed_output)
          )
  
      # (batch_size, seq_len, d_model)
      return self.layer_norm_output(output)
  
imports: import math
  from typing import Any, Callable, Optional, Tuple
  import torch
  from torch import nn
label_desc: Use image node_id 2 for calling the Decoder obj's underlying member method code with example usage: obj.forward(tgt, memory, source_mask, target_mask) and returns: self