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
code: def __init__(
      self,
      args,
      dictionary,
      embed_tokens,
      no_encoder_decoder_attn=False,
  ):
      super().__init__(dictionary)
      self.register_buffer("version", torch.Tensor([3]))
  
      self.dropout = args.dropout
      self.share_input_output_embed = (
          args.share_decoder_input_output_embed
      )
  
      input_embed_dim = embed_tokens.embedding_dim
      embed_dim = args.decoder_embed_dim
      self.output_embed_dim = args.decoder_output_dim
  
      padding_idx = embed_tokens.padding_idx
      self.max_target_positions = args.max_target_positions
  
      self.embed_tokens = embed_tokens
      self.embed_scale = math.sqrt(
          embed_dim
      )  # todo: try with input_embed_dim
  
      self.project_in_dim = (
          Linear(input_embed_dim, embed_dim, bias=False)
          if embed_dim != input_embed_dim
          else None
      )
  
      self.embed_positions = (
          PositionalEmbedding(
              args.max_target_positions,
              embed_dim,
              padding_idx,
              learned=args.decoder_learned_pos,
          )
          if not args.no_token_positional_embeddings
          else None
      )
  
      self.layers = nn.ModuleList([])
      self.layers.extend(
          [
              TransformerDecoderLayerPhase2(
                  args, no_encoder_decoder_attn
              )
              for _ in range(args.decoder_layers)
          ]
      )
  
      self.adaptive_softmax = None
  
      self.project_out_dim = (
          Linear(embed_dim, self.output_embed_dim, bias=False)
          if embed_dim != self.output_embed_dim
          and not args.tie_adaptive_weights
          else None
      )
  
      if args.adaptive_softmax_cutoff is not None:
          self.adaptive_softmax = AdaptiveSoftmax(
              len(dictionary),
              self.output_embed_dim,
              options.eval_str_list(
                  args.adaptive_softmax_cutoff, type=int
              ),
              dropout=args.adaptive_softmax_dropout,
              adaptive_inputs=embed_tokens
              if args.tie_adaptive_weights
              else None,
              factor=args.adaptive_softmax_factor,
              tie_proj=args.tie_adaptive_proj,
          )
      elif not self.share_input_output_embed:
          self.embed_out = nn.Parameter(
              torch.Tensor(len(dictionary), self.output_embed_dim)
          )
          nn.init.normal_(
              self.embed_out, mean=0, std=self.output_embed_dim**-0.5
          )
  
      if args.decoder_normalize_before and not getattr(
          args, "no_decoder_final_norm", False
      ):
          self.layer_norm = LayerNorm(embed_dim)
      else:
          self.layer_norm = None
  
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 1 to create a new TransformerDecoderPhase2 object from inherited base classes: FairseqIncrementalDecoder with example: obj = TransformerDecoderPhase2(args, dictionary, embed_tokens, no_encoder_decoder_attn)