class_docstr: Transformer Decoder module for decoder-only architecture.
  
  Intended to be used with a PassThroughEncoder, which will pass the context to this decoder unchanged.
  
  For documentation on parameters that are taken directly from opt,
  see parlai/agents/transformer/transformer.py
docstr: Instantiate a single layer. Called n_layers times during __init__.
  
  Overridden to allow swapping out of the layer class at instantiation.
  
  :param int index:
      Index of current layer.
docstr_tok: ["Instantiate","a","single","layer",".","Called","n_layers","times","during","__init__",".","Overridden","to","allow","swapping","out","of","the","layer","class","at","instantiation",".",":","param","int","index",":","Index","of","current","layer","."]
code: def build_layer(self, index: int) -> BaseTransformerDecoderLayer:
      """
      Instantiate a single layer. Called n_layers times during __init__.
  
      Overridden to allow swapping out of the layer class at instantiation.
  
      :param int index:
          Index of current layer.
      """
      return self.swappables.layer(  # type: ignore
          self.opt,
          attention_dropout=self.opt.get("attention_dropout", 0.0),
          relu_dropout=self.opt.get("relu_dropout", 0.0),
          dropout=self.opt.get("dropout", 0.0),
          activation=self.activation,
          variant=self.variant,
      )
  
imports: from __future__ import annotations
  from abc import ABC
  from typing import Dict, Optional, Tuple
  import numpy
  import torch
  import torch.nn
  from parlai.agents.transformer.modules import create_position_codes, get_n_positions_from_options, LAYER_NORM_EPS, MultiHeadAttention, TransformerFFN
  from parlai.agents.transformer.modules.modular import swappable
  from parlai.core.opt import Opt
  from parlai.core.params import default
  from parlai.core.torch_agent import DictionaryAgent
  from parlai.utils.misc import warn_once
  from parlai.utils.torch import PipelineHelper
  from parlai.utils.fsdp import fsdp_wrap
  from parlai.nn.checkpoint import checkpoint_wrapper
label_desc: Use image node_id 1 for calling the TransformerDecoderOnly obj's underlying member method code with example usage: obj.build_layer(index) and returns: self