class_docstr: Transformer decoder consisting of *cfg.decoder.layers* layers. Each layer
  is a :class:`TransformerDecoderLayer`.
  
  Args:
      cfg (argparse.Namespace): parsed command-line arguments
      dictionary (~fairseq.data.Dictionary): decoding dictionary
      embed_tokens (torch.nn.Embedding): output embedding
      no_encoder_attn (bool, optional): whether to attend to encoder outputs
          (default: False).
class_docstr_tok: ["Transformer","decoder","consisting","of","*","cfg.decoder.layers","*","layers",".","Each","layer","is","a",":","class",":","`","TransformerDecoderLayer","`",".","Args",":","cfg","(","argparse.Namespace",")",":","parsed","command-line","arguments","dictionary","(","~fairseq.data.Dictionary",")",":","decoding","dictionary","embed_tokens","(","torch.nn.Embedding",")",":","output","embedding","no_encoder_attn","(","bool",",","optional",")",":","whether","to","attend","to","encoder","outputs","(","default",":","False",")","."]
code: def build_decoder_layer(self, cfg, no_encoder_attn=False):
      layer = transformer_layer.TransformerDecoderLayerBase(
          cfg, no_encoder_attn
      )
      checkpoint = cfg.checkpoint_activations
      if checkpoint:
          offload_to_cpu = cfg.offload_activations
          layer = checkpoint_wrapper(
              layer, offload_to_cpu=offload_to_cpu
          )
      # if we are checkpointing, enforce that FSDP always wraps the
      # checkpointed layer, regardless of layer size
      min_params_to_wrap = (
          cfg.min_params_to_wrap if not checkpoint else 0
      )
      layer = fsdp_wrap(layer, min_num_params=min_params_to_wrap)
      return layer
  
imports: import math
  from typing import Any, Dict, List, Optional
  import torch
  import torch.nn
  from torch import Tensor
  from fairseq import utils
  from fairseq.distributed import fsdp_wrap
  from fairseq.models import FairseqIncrementalDecoder
  from fairseq.models.transformer import TransformerConfig
  from fairseq.modules import AdaptiveSoftmax, BaseLayer, FairseqDropout, LayerDropModuleList, LayerNorm, PositionalEmbedding, SinusoidalPositionalEmbedding, transformer_layer
  from fairseq.modules.checkpoint_activations import checkpoint_wrapper
  from fairseq.modules.quant_noise import quant_noise
label_desc: Use image node_id 3 for calling the TransformerDecoderBase obj's underlying member method code with example usage: obj.build_decoder_layer(cfg, no_encoder_attn) and returns: layer