docstr: Args:
      prev_output_tokens (LongTensor): previous decoder outputs of shape
          `(batch, tgt_len)`, for teacher forcing
      encoder_out (optional): output from the encoder, used for
          encoder-side attention
      incremental_state (dict): dictionary used for storing state during
          :ref:`Incremental decoding`
      features_only (bool, optional): only return features without
          applying output layer (default: False).
  
  Returns:
      tuple:
          - the decoder's output of shape `(batch, tgt_len, vocab)`
          - a dictionary with any model-specific outputs
docstr_tok: ["Args",":","prev_output_tokens","(","LongTensor",")",":","previous","decoder","outputs","of","shape","`","(","batch",",","tgt_len",")","`",",","for","teacher","forcing","encoder_out","(","optional",")",":","output","from","the","encoder",",","used","for","encoder-side","attention","incremental_state","(","dict",")",":","dictionary","used","for","storing","state","during",":","ref",":","`","Incremental","decoding","`","features_only","(","bool",",","optional",")",":","only","return","features","without","applying","output","layer","(","default",":","False",")",".","Returns",":","tuple",":","-","the","decoder","'s","output","of","shape","`","(","batch",",","tgt_len",",","vocab",")","`","-","a","dictionary","with","any","model-specific","outputs"]
code: def forward(
      self,
      prev_output_tokens,
      encoder_out: Optional[Dict[str, List[Tensor]]] = None,
      incremental_state: Optional[
          Dict[str, Dict[str, Optional[Tensor]]]
      ] = None,
      features_only: bool = False,
      alignment_layer: Optional[int] = None,
      alignment_heads: Optional[int] = None,
      src_lengths: Optional[Any] = None,
      return_all_hiddens: bool = False,
      lang_id: Optional[int] = None,
  ):
      """
      Args:
          prev_output_tokens (LongTensor): previous decoder outputs of shape
              `(batch, tgt_len)`, for teacher forcing
          encoder_out (optional): output from the encoder, used for
              encoder-side attention
          incremental_state (dict): dictionary used for storing state during
              :ref:`Incremental decoding`
          features_only (bool, optional): only return features without
              applying output layer (default: False).
  
      Returns:
          tuple:
              - the decoder's output of shape `(batch, tgt_len, vocab)`
              - a dictionary with any model-specific outputs
      """
  
      assert lang_id is not None
  
      x, extra = self.extract_features(
          prev_output_tokens,
          encoder_out=encoder_out,
          incremental_state=incremental_state,
          alignment_layer=alignment_layer,
          alignment_heads=alignment_heads,
          lang_id=lang_id,
      )
      if not features_only:
          x = self.output_layer(x)
      return x, extra
  
imports: import logging
  from typing import Any, Dict, List, Optional
  from torch import Tensor
  import torch
  import torch.nn
  from fairseq.models import FairseqEncoderDecoderModel, register_model, register_model_architecture
  from fairseq.models.transformer import base_architecture, Embedding, TransformerModel, TransformerEncoder, TransformerDecoder
  from fairseq.modules import TransformerDecoderLayer
label_desc: Use image node_id 4 for calling the LaserTransformerDecoder obj's underlying member method code with example usage: obj.forward(prev_output_tokens, encoder_out, incremental_state, features_only, alignment_layer, alignment_heads, src_lengths, return_all_hiddens, lang_id) and returns: x,  extra