class_docstr: Second phase of decoder layer block
      Each layer will be of type TransformerDecoderLayerPhase2
  Args:
      args (argparse.Namespace): parsed command-line arguments
      dictionary (~fairseq.data.Dictionary): encoding dictionary
      embed_tokens (torch.nn.Embedding): input embedding
      no_encoder_decoder_attn: If encoder decoder attention is required or not
docstr: Similar to *forward* but only return features.
  
  Returns:
      tuple:
          - the decoder's features of shape `(batch, tgt_len, embed_dim)`
          - a dictionary with any model-specific outputs
docstr_tok: ["Similar","to","*","forward","*","but","only","return","features",".","Returns",":","tuple",":","-","the","decoder","'s","features","of","shape","`","(","batch",",","tgt_len",",","embed_dim",")","`","-","a","dictionary","with","any","model-specific","outputs"]
code: def extract_features(
      self,
      prev_output_tokens,
      encoder_out=None,
      decoder_out=None,
      incremental_state=None,
      **unused,
  ):
      """
      Similar to *forward* but only return features.
  
      Returns:
          tuple:
              - the decoder's features of shape `(batch, tgt_len, embed_dim)`
              - a dictionary with any model-specific outputs
      """
      # embed positions
      positions = (
          self.embed_positions(
              prev_output_tokens, incremental_state=incremental_state
          )
          if self.embed_positions is not None
          else None
      )
  
      if incremental_state is not None:
          prev_output_tokens = prev_output_tokens[:, -1:]
          if positions is not None:
              positions = positions[:, -1:]
  
      # embed tokens and positions
      x = self.embed_scale * self.embed_tokens(prev_output_tokens)
  
      if self.project_in_dim is not None:
          x = self.project_in_dim(x)
  
      if positions is not None:
          x += positions
      x = F.dropout(x, p=self.dropout, training=self.training)
  
      # B x T x C -> T x B x C
      x = x.transpose(0, 1)
      attn = None
  
      inner_states = [x]
  
      # decoder layers
      for layer in self.layers:
          x, attn = layer(
              x,
              encoder_out["encoder_out"]
              if encoder_out is not None
              else None,
              encoder_out["encoder_padding_mask"]
              if encoder_out is not None
              else None,
              decoder_out,
              incremental_state,
              self_attn_mask=self.buffered_future_mask(x)
              if incremental_state is None
              else None,
          )
          inner_states.append(x)
  
      if self.layer_norm:
          x = self.layer_norm(x)
  
      # T x B x C -> B x T x C
      x = x.transpose(0, 1)
  
      if self.project_out_dim is not None:
          x = self.project_out_dim(x)
  
      return x, {"attn": attn, "inner_states": inner_states}
  
imports: import math
  import torch
  import torch.nn
  import torch.nn.functional
  from fairseq import options, utils
  from fairseq.models import FairseqEncoderDecoderModel, FairseqIncrementalDecoder, register_model, register_model_architecture
  from fairseq.models.transformer import Embedding, Linear, TransformerDecoder, TransformerEncoder
  from fairseq.modules import AdaptiveSoftmax, LayerNorm, MultiheadAttention, PositionalEmbedding, SinusoidalPositionalEmbedding
label_desc: Use image node_id 3 for calling the TransformerDecoderPhase2 obj's underlying member method code with example usage: obj.extract_features(prev_output_tokens, encoder_out, decoder_out, incremental_state) and returns: x,  dict