class_docstr: RagModel.
  
  The RagModel operates in the following phases:
  1) retrieve:    given a tokenized query, return relevant documents
  2) expand:      given queries and documents, expand the inputs n_docs times,
                  concatenating each document with a relevant context
  3) encode:      given expanded input, encode into encoder representations
  4) decoding:    given encoder outputs, compute n_docs decoder representations for
                  each batch item.
  5) marginalize: given the decoded representations, marginalize over the documents
  appropriately.
  
  The RagModel overloads the `encoder` and `decoder` attributes of your standard
  `TorchGeneratorModel` to accomplish the five phases above.
docstr: Simulate a standard seq2seq encoder/decoder forward pass.
  
  Used in thorough decoding.
  
  :param xs:
      input tokens
  :param ys:
      teacher forced decoder outputs
  
  :return (logits, preds, encoder_states):
      logits: token output distribution
      preds: max probability token at each output position
      encoder_states: output states from the encoder
docstr_tok: ["Simulate","a","standard","seq2seq","encoder\/decoder","forward","pass",".","Used","in","thorough","decoding",".",":","param","xs",":","input","tokens",":","param","ys",":","teacher","forced","decoder","outputs",":","return","(","logits",",","preds",",","encoder_states",")",":","logits",":","token","output","distribution","preds",":","max","probability","token","at","each","output","position","encoder_states",":","output","states","from","the","encoder"]
code: def seq2seq_forward_pass(
      self, xs: torch.LongTensor, ys: torch.LongTensor
  ) -> Tuple[torch.Tensor, torch.Tensor, Tuple[Any, ...]]:
      """
      Simulate a standard seq2seq encoder/decoder forward pass.
  
      Used in thorough decoding.
  
      :param xs:
          input tokens
      :param ys:
          teacher forced decoder outputs
  
      :return (logits, preds, encoder_states):
          logits: token output distribution
          preds: max probability token at each output position
          encoder_states: output states from the encoder
      """
      encoder_states = self.seq2seq_encoder(xs)  # type: ignore
      bsz = ys.size(0)
      seqlen = ys.size(1)
      inputs = ys.narrow(1, 0, seqlen - 1)
      dec_inputs = (
          self._rag_model_interface.get_initial_forced_decoder_input(
              bsz,
              inputs,
              n_docs=1,
              start_idx=self.START_IDX,
              end_idx=self.END_IDX,
              input_turns_cnt=None,
          )
      )
      latent, _ = self.seq2seq_decoder(
          dec_inputs, encoder_states, None
      )  # type: ignore
      logits = self.decoder_output(latent)
      _, preds = logits.max(dim=-1)
      return logits, preds, encoder_states
  
imports: import torch
  import torch.cuda
  import torch.nn
  import torch.nn.functional
  from typing import Any, Tuple, Dict, Optional, List, Union, Type
  from parlai.agents.hugging_face.t5 import ParlaiT5Encoder, ParlaiT5Decoder, build_t5, set_device
  from parlai.agents.transformer.modules import TransformerEncoder, TransformerDecoder, get_n_positions_from_options, create_embeddings
  from parlai.core.dict import DictionaryAgent
  from parlai.core.opt import Opt
  from parlai.core.torch_generator_agent import TorchGeneratorModel
  from parlai.utils.torch import padded_tensor
  from parlai.agents.rag.retrievers import RagRetriever, retriever_factory, Document
label_desc: Use image node_id 9 for calling the RagModel obj's underlying member method code with example usage: obj.seq2seq_forward_pass(xs, ys) and returns: logits,  preds,  encoder_states