class_docstr: Agent which takes an input sequence and produces an output sequence.
  
  This model supports encoding the input and decoding the output via one of
  several flavors of RNN. It then uses a linear layer (whose weights can
  be shared with the embedding layer) to convert RNN output states into
  output tokens. This model supports greedy decoding, selecting the
  highest probability token at each time step, as well as beam
  search.
  
  For more information, see the following papers:
  
  - Neural Machine Translation by Jointly Learning to Align and Translate
    `(Bahdanau et al. 2014) <arxiv.org/abs/1409.0473>`_
  - Sequence to Sequence Learning with Neural Networks
    `(Sutskever et al. 2014) <arxiv.org/abs/1409.3215>`_
  - Effective Approaches to Attention-based Neural Machine Translation
    `(Luong et al. 2015) <arxiv.org/abs/1508.04025>`_
class_docstr_tok: ["Agent","which","takes","an","input","sequence","and","produces","an","output","sequence",".","This","model","supports","encoding","the","input","and","decoding","the","output","via","one","of","several","flavors","of","RNN",".","It","then","uses","a","linear","layer","(","whose","weights","can","be","shared","with","the","embedding","layer",")","to","convert","RNN","output","states","into","output","tokens",".","This","model","supports","greedy","decoding",",","selecting","the","highest","probability","token","at","each","time","step",",","as","well","as","beam","search",".","For","more","information",",","see","the","following","papers",":","-","Neural","Machine","Translation","by","Jointly","Learning","to","Align","and","Translate","`","(","Bahdanau","et","al",".","2014",")","<","arxiv.org\/abs\/1409.0473",">","`","_","-","Sequence","to","Sequence","Learning","with","Neural","Networks","`","(","Sutskever","et","al",".","2014",")","<","arxiv.org\/abs\/1409.3215",">","`","_","-","Effective","Approaches","to","Attention-based","Neural","Machine","Translation","`","(","Luong","et","al",".","2015",")","<","arxiv.org\/abs\/1508.04025",">","`","_"]
docstr: Override batchify options for seq2seq.
docstr_tok: ["Override","batchify","options","for","seq2seq","."]
code: def batchify(self, *args, **kwargs):
      """
      Override batchify options for seq2seq.
      """
      kwargs["sort"] = True  # need sorted for pack_padded
      # TODO: Sorting the batch will result in various local metrics being broadcasted
      # back to individual examples in the wrong order, such as the lengths of
      # the context and labels. Aggregate metric reports will still be accurate.
      return super().batchify(*args, **kwargs)
  
file_path: ParlAI/parlai/agents/seq2seq/seq2seq.py
imports: from typing import Optional
  from parlai.core.params import ParlaiParser
  from parlai.core.opt import Opt
  from parlai.core.torch_generator_agent import TorchGeneratorAgent
  from parlai.utils.misc import warn_once
  from parlai.utils.io import PathManager
  from .modules import Seq2seq, opt_to_kwargs
  import torch
  import torch.nn
label_desc: Use image node_id 5 for calling the Seq2seqAgent obj's underlying member method code with example usage: obj.batchify() and returns: super