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: Decode with a fixed, true sequence, computing loss.
  
  Override TGM.decode_forced to both:
  1) handle BART eos/bos issues, and
  2) appropriately get forced decoder input.
  
  :param encoder_states:
      encoder output states
  :param ys:
      teacher forced label
  
  :return logits, preds:
      logits: output token distribution (as logits, not probs)
      preds: tokens corresponding with max probs according to output distribution.
docstr_tok: ["Decode","with","a","fixed",",","true","sequence",",","computing","loss",".","Override","TGM.decode_forced","to","both",":","1",")","handle","BART","eos\/bos","issues",",","and","2",")","appropriately","get","forced","decoder","input",".",":","param","encoder_states",":","encoder","output","states",":","param","ys",":","teacher","forced","label",":","return","logits",",","preds",":","logits",":","output","token","distribution","(","as","logits",",","not","probs",")","preds",":","tokens","corresponding","with","max","probs","according","to","output","distribution","."]
code: def decode_forced(
      self,
      encoder_states: Tuple[torch.Tensor, ...],
      ys: torch.LongTensor,
  ) -> Tuple[torch.Tensor, torch.LongTensor]:
      """
      Decode with a fixed, true sequence, computing loss.
  
      Override TGM.decode_forced to both:
      1) handle BART eos/bos issues, and
      2) appropriately get forced decoder input.
  
      :param encoder_states:
          encoder output states
      :param ys:
          teacher forced label
  
      :return logits, preds:
          logits: output token distribution (as logits, not probs)
          preds: tokens corresponding with max probs according to output distribution.
      """
      bsz = ys.size(0)
      seqlen = ys.size(1)
      inputs = ys.narrow(1, 0, seqlen - 1)
      if (
          ys[:, 0] == self.START_IDX
      ).any() and self.generation_model != "bart":
          raise AssertionError(
              "The Beginning of Sentence token is automatically added to the "
              "label in decode_forced, but you included it in the label. This means "
              "your model will have a double BOS token, which is probably not what "
              "you intended."
          )
      doc_scores = encoder_states[-1]
  
      inputs = (
          self._rag_model_interface.get_initial_forced_decoder_input(
              bsz,
              inputs,
              n_docs=doc_scores.size(1)
              if doc_scores is not None
              else None,
              start_idx=self.START_IDX,
              end_idx=self.END_IDX,
              input_turns_cnt=encoder_states[2],
          )
      )
      latent, _ = self.decoder(inputs, encoder_states)
      logits = self.output(latent)
      _, preds = logits.max(dim=-1)
      return logits, preds
  
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 16 for calling the RagModel obj's underlying member method code with example usage: obj.decode_forced(encoder_states, ys) and returns: logits,  preds