class_docstr: Represents a Transformer decoder.
class_docstr_tok: ["Represents","a","Transformer","decoder","."]
docstr: :param seqs:
      The sequences to decode. *Shape:* :math:`(N,S,M)`, where :math:`N`
      is the batch size, :math:`S` is the sequence length, and :math:`M`
      is the dimensionality of the model.
  :param padding_mask:
      The padding mask of ``seqs``. *Shape:* :math:`(N,S)`, where :math:`N`
      is the batch size and :math:`S` is the sequence length.
  :param encoder_output:
      The encoder output to use in encoder-decoder attention. *Shape:*
      :math:`(N,S_{enc},M_{enc})`, where :math:`N` is the batch size,
      :math:`S_{enc}` is the encoder output sequence length, and
      :math:`M_{enc}` is the dimensionality of the encoder.
  :param encoder_padding_mask:
      The padding mask of ``encoder_output``. *Shape:* :math:`(N,S_{enc})`,
      where :math:`N` is the batch size and :math:`S_{enc}` is the encoder
      output sequence length.
  :param state_bag:
      The state bag to use for incremental decoding.
  
  :returns:
      - The decoder output. *Shape:* Same as ``seqs``.
      - The padding mask of the decoder output. *Shape:* Same as
        ``padding_mask``.
docstr_tok: [":","param","seqs",":","The","sequences","to","decode",".","*","Shape",":","*",":","math",":","`","(","N",",","S",",","M",")","`",",","where",":","math",":","`","N","`","is","the","batch","size",",",":","math",":","`","S","`","is","the","sequence","length",",","and",":","math",":","`","M","`","is","the","dimensionality","of","the","model",".",":","param","padding_mask",":","The","padding","mask","of","``","seqs","``",".","*","Shape",":","*",":","math",":","`","(","N",",","S",")","`",",","where",":","math",":","`","N","`","is","the","batch","size","and",":","math",":","`","S","`","is","the","sequence","length",".",":","param","encoder_output",":","The","encoder","output","to","use","in","encoder-decoder","attention",".","*","Shape",":","*",":","math",":","`","(","N",",","S_","{","enc","}",",","M_","{","enc","}",")","`",",","where",":","math",":","`","N","`","is","the","batch","size",",",":","math",":","`","S_","{","enc","}","`","is","the","encoder","output","sequence","length",",","and",":","math",":","`","M_","{","enc","}","`","is","the","dimensionality","of","the","encoder",".",":","param","encoder_padding_mask",":","The","padding","mask","of","``","encoder_output","``",".","*","Shape",":","*",":","math",":","`","(","N",",","S_","{","enc","}",")","`",",","where",":","math",":","`","N","`","is","the","batch","size","and",":","math",":","`","S_","{","enc","}","`","is","the","encoder","output","sequence","length",".",":","param","state_bag",":","The","state","bag","to","use","for","incremental","decoding",".",":","returns",":","-","The","decoder","output",".","*","Shape",":","*","Same","as","``","seqs","``",".","-","The","padding","mask","of","the","decoder","output",".","*","Shape",":","*","Same","as","``","padding_mask","``","."]
code: def forward(
      self,
      seqs: Tensor,
      padding_mask: Optional[PaddingMask],
      encoder_output: Optional[Tensor] = None,
      encoder_padding_mask: Optional[PaddingMask] = None,
      *,
      state_bag: Optional[IncrementalStateBag] = None,
  ) -> Tuple[Tensor, Optional[PaddingMask]]:
      """
      :param seqs:
          The sequences to decode. *Shape:* :math:`(N,S,M)`, where :math:`N`
          is the batch size, :math:`S` is the sequence length, and :math:`M`
          is the dimensionality of the model.
      :param padding_mask:
          The padding mask of ``seqs``. *Shape:* :math:`(N,S)`, where :math:`N`
          is the batch size and :math:`S` is the sequence length.
      :param encoder_output:
          The encoder output to use in encoder-decoder attention. *Shape:*
          :math:`(N,S_{enc},M_{enc})`, where :math:`N` is the batch size,
          :math:`S_{enc}` is the encoder output sequence length, and
          :math:`M_{enc}` is the dimensionality of the encoder.
      :param encoder_padding_mask:
          The padding mask of ``encoder_output``. *Shape:* :math:`(N,S_{enc})`,
          where :math:`N` is the batch size and :math:`S_{enc}` is the encoder
          output sequence length.
      :param state_bag:
          The state bag to use for incremental decoding.
  
      :returns:
          - The decoder output. *Shape:* Same as ``seqs``.
          - The padding mask of the decoder output. *Shape:* Same as
            ``padding_mask``.
      """
  
imports: from __future__ import annotations
  from abc import ABC, abstractmethod
  from collections import OrderedDict
  from typing import Dict, Iterable, Optional, Protocol, Tuple, final
  from torch import Tensor
  from torch.nn import Module
  from torch.utils.hooks import RemovableHandle
  from fairseq2.nn.incremental_state import IncrementalStateBag
  from fairseq2.nn.module_list import ModuleList
  from fairseq2.nn.normalization import LayerNorm
  from fairseq2.nn.padding import PaddingMask
  from fairseq2.nn.transformer.attention_mask import AttentionMaskFactory, CausalAttentionMaskFactory
  from fairseq2.nn.transformer.decoder_layer import TransformerDecoderLayer
  from fairseq2.nn.transformer.layer_norm import LayerNormFactory, create_standard_layer_norm
  from fairseq2.nn.transformer.norm_order import TransformerNormOrder
  from fairseq2.typing import DataType, Device, finaloverride
label_desc: Use image node_id 2 for calling the TransformerDecoder obj's underlying member method code with example usage: obj.forward(seqs, padding_mask, encoder_output, encoder_padding_mask) without return types