class_docstr: Represents an encoder-decoder model.
class_docstr_tok: ["Represents","an","encoder-decoder","model","."]
docstr: Encode the specified source sequences.
  
  :param seqs:
      The source sequences to encode. *Shape:* :math:`(N,S_{src},*)`,
      where :math:`N` is the batch size, :math:`S_{src}` is the source
      sequence length, and :math:`*` is any number of sequence-specific
      dimensions including none.
  :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.
  
  :returns:
      - The encoder output. *Shape:* :math:`(N,S_{out},M)`, where
        :math:`N` is the batch size, :math:`S_{out}` is the output
        sequence length, and :math:`M` is the dimensionality of the model.
      - The padding mask of the encoder output. *Shape:*
        :math:`(N,S_{out})`, where :math:`N` is the batch size and
        :math:`S_{out}` is the output sequence length.
docstr_tok: ["Encode","the","specified","source","sequences",".",":","param","seqs",":","The","source","sequences","to","encode",".","*","Shape",":","*",":","math",":","`","(","N",",","S_","{","src","}",",","*",")","`",",","where",":","math",":","`","N","`","is","the","batch","size",",",":","math",":","`","S_","{","src","}","`","is","the","source","sequence","length",",","and",":","math",":","`","*","`","is","any","number","of","sequence-specific","dimensions","including","none",".",":","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",".",":","returns",":","-","The","encoder","output",".","*","Shape",":","*",":","math",":","`","(","N",",","S_","{","out","}",",","M",")","`",",","where",":","math",":","`","N","`","is","the","batch","size",",",":","math",":","`","S_","{","out","}","`","is","the","output","sequence","length",",","and",":","math",":","`","M","`","is","the","dimensionality","of","the","model",".","-","The","padding","mask","of","the","encoder","output",".","*","Shape",":","*",":","math",":","`","(","N",",","S_","{","out","}",")","`",",","where",":","math",":","`","N","`","is","the","batch","size","and",":","math",":","`","S_","{","out","}","`","is","the","output","sequence","length","."]
code: def encode(
      self, seqs: Tensor, padding_mask: Optional[PaddingMask]
  ) -> Tuple[Tensor, Optional[PaddingMask]]:
      """Encode the specified source sequences.
  
      :param seqs:
          The source sequences to encode. *Shape:* :math:`(N,S_{src},*)`,
          where :math:`N` is the batch size, :math:`S_{src}` is the source
          sequence length, and :math:`*` is any number of sequence-specific
          dimensions including none.
      :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.
  
      :returns:
          - The encoder output. *Shape:* :math:`(N,S_{out},M)`, where
            :math:`N` is the batch size, :math:`S_{out}` is the output
            sequence length, and :math:`M` is the dimensionality of the model.
          - The padding mask of the encoder output. *Shape:*
            :math:`(N,S_{out})`, where :math:`N` is the batch size and
            :math:`S_{out}` is the output sequence length.
      """
  
file_path: fairseq2/src/fairseq2/models/encoder_decoder.py
imports: from abc import abstractmethod
  from typing import Optional, Tuple
  from torch import Tensor
  from fairseq2.data import VocabularyInfo
  from fairseq2.models.seq2seq import Seq2SeqBatch, Seq2SeqModel
  from fairseq2.models.sequence import SequenceModelOutput
  from fairseq2.nn.incremental_state import IncrementalStateBag
  from fairseq2.nn.padding import PaddingMask
  from fairseq2.typing import override
label_desc: Use image node_id 3 for calling the EncoderDecoderModel obj's underlying member method code with example usage: obj.encode(seqs, padding_mask) without return types