class_docstr: An architecture to jointly train primal model and dual model by leveraging
  distribution duality, which exist for both parallel data and monolingual
  data.
class_docstr_tok: ["An","architecture","to","jointly","train","primal","model","and","dual","model","by","leveraging","distribution","duality",",","which","exist","for","both","parallel","data","and","monolingual","data","."]
docstr: If batch is monolingual, need to run beam decoding to generate
  fake prev_output_tokens.
docstr_tok: ["If","batch","is","monolingual",",","need","to","run","beam","decoding","to","generate","fake","prev_output_tokens","."]
code: def forward(self, src_tokens, src_lengths, prev_output_tokens=None):
      """
      If batch is monolingual, need to run beam decoding to generate
      fake prev_output_tokens.
      """
  
      # TODO: pass to dual model too
      primal_encoder_out = self.models["primal"].encoder(
          src_tokens, src_lengths
      )
      primal_decoder_out = self.models["primal"].decoder(
          prev_output_tokens, primal_encoder_out
      )
      return primal_decoder_out
  
file_path: translate/pytorch_translate/dual_learning/dual_learning_models.py
imports: import logging
  import torch.nn
  from fairseq import checkpoint_utils
  from fairseq.models import BaseFairseqModel, register_model
  from pytorch_translate import rnn
  from pytorch_translate.rnn import base_architecture, LSTMSequenceEncoder, RNNDecoder, RNNEncoder, RNNModel
  from pytorch_translate.tasks.pytorch_translate_task import PytorchTranslateTask
label_desc: Use image node_id 2 for calling the DualLearningModel obj's underlying member method code with example usage: obj.forward(src_tokens, src_lengths, prev_output_tokens) and returns: primal_decoder_out