class_docstr: The transformer decoder.
  
  Args:
      encoder_layer(nn.Layer): The base layer to compose the decoder.
      num_layers(int): How many layers is used in the decoder.
      norm(str): the kind of normalization that used before output.
      return_intermediate(bool): Whether to output the intermediate feature.
class_docstr_tok: ["The","transformer","decoder",".","Args",":","encoder_layer","(","nn.Layer",")",":","The","base","layer","to","compose","the","decoder",".","num_layers","(","int",")",":","How","many","layers","is","used","in","the","decoder",".","norm","(","str",")",":","the","kind","of","normalization","that","used","before","output",".","return_intermediate","(","bool",")",":","Whether","to","output","the","intermediate","feature","."]
code: def forward(
      self,
      tgt,
      memory,
      tgt_mask=None,
      memory_mask=None,
      tgt_key_padding_mask=None,
      memory_key_padding_mask=None,
      pos=None,
      query_pos=None,
  ):
      output = tgt
      intermediate = []
      for layer in self.decoder_list:
          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,
          )
          if self.return_intermediate:
              intermediate.append(self.norm(output))
  
      if self.norm is not None:
          output = self.norm(output)
          if self.return_intermediate:
              intermediate.pop()
              intermediate.append(output)
  
      if self.return_intermediate:
          return paddle.stack(intermediate)
  
      return output.unsqueeze(0)
  
imports: import math
  import copy
  import paddle
  import paddle.nn
  import paddle.nn.functional
  from paddleseg.models import layers
  from paddleseg.cvlibs import manager, param_init
  from paddleseg.utils import utils
  from paddleseg.core.train import check_logits_losses
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, paddle