class_docstr: Input feeding based decoder.
  
  See :class:`~onmt.decoders.decoder.RNNDecoderBase` for options.
  
  Based around the input feeding approach from
  "Effective Approaches to Attention-based Neural Machine Translation"
  :cite:`Luong2015`
class_docstr_tok: ["Input","feeding","based","decoder",".","See",":","class",":","`","~onmt.decoders.decoder.RNNDecoderBase","`","for","options",".","Based","around","the","input","feeding","approach","from","''","Effective","Approaches","to","Attention-based","Neural","Machine","Translation","''",":","cite",":","`","Luong2015","`"]
docstr: See StdRNNDecoder._run_forward_pass() for description
  of arguments and return values.
docstr_tok: ["See","StdRNNDecoder._run_forward_pass","(",")","for","description","of","arguments","and","return","values","."]
code: def _run_forward_pass(self, tgt, enc_out, src_len=None):
      """
      See StdRNNDecoder._run_forward_pass() for description
      of arguments and return values.
      """
      # Additional args check.
      input_feed = self.state["input_feed"].squeeze(0)
  
      dec_outs = []
      attns = {}
      if self.attn is not None:
          attns["std"] = []
      if self.copy_attn is not None or self._reuse_copy_attn:
          attns["copy"] = []
      if self._coverage:
          attns["coverage"] = []
  
      emb = self.embeddings(tgt)
      assert emb.dim() == 3  # batch x len x embedding_dim
  
      dec_state = self.state["hidden"]
  
      coverage = (
          self.state["coverage"].squeeze(0)
          if self.state["coverage"] is not None
          else None
      )
  
      # Input feed concatenates hidden state with
      # input at every time step.
      for emb_t in emb.split(1, dim=1):
          dec_in = torch.cat([emb_t.squeeze(1), input_feed], 1)
          rnn_out, dec_state = self.rnn(dec_in, dec_state)
          if self.attentional:
              dec_out, p_attn = self.attn(
                  rnn_out, enc_out, src_len=src_len
              )
              attns["std"].append(p_attn)
          else:
              dec_out = rnn_out
          if self.context_gate is not None:
              # TODO: context gate should be employed
              # instead of second RNN transform.
              dec_out = self.context_gate(dec_in, rnn_out, dec_out)
          dec_out = self.dropout(dec_out)
          input_feed = dec_out
  
          dec_outs += [dec_out]
  
          # Update the coverage attention.
          # attns["coverage"] is actually c^(t+1) of See et al(2017)
          # 1-index shifted
          if self._coverage:
              coverage = (
                  p_attn if coverage is None else p_attn + coverage
              )
              attns["coverage"] += [coverage]
  
          if self.copy_attn is not None:
              _, copy_attn = self.copy_attn(dec_out, enc_out)
              attns["copy"] += [copy_attn]
          elif self._reuse_copy_attn:
              attns["copy"] = attns["std"]
  
      return dec_state, dec_outs, attns
  
imports: import torch
  import torch.nn
  from onmt.modules.stacked_rnn import StackedLSTM, StackedGRU
  from onmt.modules import context_gate_factory, GlobalAttention
  from onmt.utils.rnn_factory import rnn_factory
label_desc: Use image node_id 1 for calling the InputFeedRNNDecoder obj's underlying member method code with example usage: obj._run_forward_pass(tgt, enc_out, src_len) and returns: dec_state,  dec_outs,  attns