class_docstr: Custom Decoder with Ladder model.
docstr: Override of forward_layers of TransformerDecoder.
docstr_tok: ["Override","of","forward_layers","of","TransformerDecoder","."]
code: def forward_layers(
      self,
      tensor: torch.Tensor,
      encoder_output: torch.Tensor,
      encoder_mask: torch.Tensor,
      incr_state: Dict[int, Dict[str, Dict[str, torch.Tensor]]],
      **kwargs,
  ) -> Tuple[torch.Tensor, Dict[str, torch.Tensor]]:
      """
      Override of forward_layers of TransformerDecoder.
      """
      new_incr_state = {}
      for _s in range(0, self.opt["ladder_size"]):
          tensor, new_incr_state = super().forward_layers(
              tensor=tensor,
              encoder_output=encoder_output,
              encoder_mask=encoder_mask,
              incr_state=incr_state,
              **kwargs,
          )
      return tensor, new_incr_state
  
imports: from __future__ import annotations
  import torch
  from typing import Dict, Optional, Tuple
  import torch.nn
  from parlai.agents.transformer.modules import TransformerDecoder, TransformerGeneratorModel
  from parlai.agents.transformer.transformer import TransformerGeneratorAgent
  from parlai.core.opt import Opt
  from parlai.core.params import ParlaiParser
  import torch.nn.functional
label_desc: Use image node_id 2 for calling the Decoder obj's underlying member method code with example usage: obj.forward_layers(tensor, encoder_output, encoder_mask, incr_state) and returns: tensor,  new_incr_state