code: def forward(
      self,
      src_tokens,
      src_lengths,
      prev_output_tokens,
      tgt_tokens,
      **kwargs,
  ):
      B, T = prev_output_tokens.size()
  
      # encoding
      encoder_out = self.encoder(
          src_tokens, src_lengths=src_lengths, **kwargs
      )
  
      # length prediction
      length_out = self.decoder.forward_length(
          normalize=False, encoder_out=encoder_out
      )
      length_tgt = self.decoder.forward_length_prediction(
          length_out, encoder_out, tgt_tokens
      )
  
      # decoding
      word_ins_outs, word_ins_tgts, word_ins_masks = [], [], []
      for t in range(self.train_step):
          word_ins_out = self.decoder(
              normalize=False,
              prev_output_tokens=prev_output_tokens,
              encoder_out=encoder_out,
              step=t,
          )
          word_ins_tgt = tgt_tokens
          word_ins_mask = word_ins_tgt.ne(self.pad)
  
          word_ins_outs.append(word_ins_out)
          word_ins_tgts.append(word_ins_tgt)
          word_ins_masks.append(word_ins_mask)
  
          if t < (self.train_step - 1):
              # prediction for next iteration
              if self.stochastic_approx:
                  word_ins_prediction = (
                      word_ins_out + gumbel_noise(word_ins_out)
                  ).max(-1)[1]
              else:
                  word_ins_prediction = word_ins_out.max(-1)[1]
  
              prev_output_tokens = prev_output_tokens.masked_scatter(
                  word_ins_mask, word_ins_prediction[word_ins_mask]
              )
  
              if self.dae_ratio > 0:
                  # we do not perform denoising for the first iteration
                  corrputed = (
                      torch.rand(
                          size=(B,), device=prev_output_tokens.device
                      )
                      < self.dae_ratio
                  )
                  corrputed_tokens = _sequential_poisoning(
                      tgt_tokens[corrputed],
                      len(self.tgt_dict),
                      0.33,
                      self.bos,
                      self.eos,
                      self.pad,
                  )
                  prev_output_tokens[corrputed] = corrputed_tokens
  
      # concat everything
      word_ins_out = torch.cat(word_ins_outs, 0)
      word_ins_tgt = torch.cat(word_ins_tgts, 0)
      word_ins_mask = torch.cat(word_ins_masks, 0)
  
      return {
          "word_ins": {
              "out": word_ins_out,
              "tgt": word_ins_tgt,
              "mask": word_ins_mask,
              "ls": self.args.label_smoothing,
              "nll_loss": True,
          },
          "length": {
              "out": length_out,
              "tgt": length_tgt,
              "factor": self.decoder.length_loss_factor,
          },
      }
  
file_path: fairseq/fairseq/models/nat/iterative_nonautoregressive_transformer.py
imports: import torch
  from fairseq.models import register_model, register_model_architecture
  from fairseq.models.nat import NATransformerModel
label_desc: Use image node_id 3 for calling the IterNATransformerModel obj's underlying member method code with example usage: obj.forward(src_tokens, src_lengths, prev_output_tokens, tgt_tokens) and returns: dict