class_docstr: Initialize the Lightseq Transformer Decoder Layer.
  
  Static variable:
      layer_id: The layer-index counter starting from 0 and incrementing by 1 every time a layer object is instantiated,
      e.g. if a model has 24 transformer layers, layer_id goes from 0 to 23.
  Arguments:
      config: An object of LSTransformerDecoderLayer config, see get_config
  
      initial_weights: Optional: Only used for unit test
  
      initial_biases: Optional: Only used for unit test
class_docstr_tok: ["Initialize","the","Lightseq","Transformer","Decoder","Layer",".","Static","variable",":","layer_id",":","The","layer-index","counter","starting","from","0","and","incrementing","by","1","every","time","a","layer","object","is","instantiated",",","e.g",".","if","a","model","has","24","transformer","layers",",","layer_id","goes","from","0","to","23",".","Arguments",":","config",":","An","object","of","LSTransformerDecoderLayer","config",",","see","get_config","initial_weights",":","Optional",":","Only","used","for","unit","test","initial_biases",":","Optional",":","Only","used","for","unit","test"]
docstr: Returns:
      weight: dict
      bias: dict
docstr_tok: ["Returns",":","weight",":","dict","bias",":","dict"]
code: def params_dict(self):
      """
      Returns:
          weight: dict
          bias: dict
      """
  
      def copy_and_view(m, shape=None):
          if shape is None:
              shape = (-1,)
          return m.data.clone().view(*shape)
  
      def _copy(m):
          return copy_and_view(m, (self.hs, self.hs))
  
      self_attn_qkvw = self._get_weights(0)
      self_attn_qw, self_attn_kw, self_attn_vw = self_attn_qkvw.split(
          self.hs * self.hs, 0
      )
      self_attn_qkvb = self._get_weights(1)
      self_attn_qb, self_attn_kb, self_attn_vb = self_attn_qkvb.split(
          self.hs, 0
      )
  
      all_enc_attn_kw, all_enc_attn_vw = None, None
      all_enc_attn_kb, all_enc_attn_vb = None, None
      if self.config.layer_id == 0:
          all_enc_attn_kvw = self._get_weights(19)
          all_enc_attn_kvw = all_enc_attn_kvw.split(
              self.hs * self.hs, 0
          )
          all_enc_attn_kw = list(map(_copy, all_enc_attn_kvw[::2]))
          all_enc_attn_vw = list(map(_copy, all_enc_attn_kvw[1::2]))
  
          all_enc_attn_kvb = self._get_weights(20)
          all_enc_attn_kvb = all_enc_attn_kvb.split(self.hs, 0)
          all_enc_attn_kb = list(
              map(copy_and_view, all_enc_attn_kvb[::2])
          )
          all_enc_attn_vb = list(
              map(copy_and_view, all_enc_attn_kvb[1::2])
          )
  
      weight = {
          "self_attn.q_proj": copy_and_view(
              self_attn_qw, (self.hs, self.hs)
          ),
          "self_attn.k_proj": copy_and_view(
              self_attn_kw, (self.hs, self.hs)
          ),
          "self_attn.v_proj": copy_and_view(
              self_attn_vw, (self.hs, self.hs)
          ),
          "self_attn.out_proj": copy_and_view(
              self._get_weights(2), (self.hs, self.hs)
          ),
          "self_attn_layer_norm": copy_and_view(
              self._get_weights(4), (self.hs,)
          ),
          "encoder_attn.q_proj": copy_and_view(
              self._get_weights(6), (self.hs, self.hs)
          ),
          "encoder_attn.out_proj": copy_and_view(
              self._get_weights(8), (self.hs, self.hs)
          ),
          "encoder_attn_layer_norm": copy_and_view(
              self._get_weights(10), (self.hs,)
          ),
          "fc1": copy_and_view(
              self._get_weights(12), (self.ims, self.hs)
          ),
          "fc2": copy_and_view(
              self._get_weights(14), (self.hs, self.ims)
          ),
          "final_layer_norm": copy_and_view(
              self._get_weights(16), (self.hs,)
          ),
          "clip_max": copy_and_view(self._get_weights(18), (24,)),
          "encoder_attn.k_proj": all_enc_attn_kw,
          "encoder_attn.v_proj": all_enc_attn_vw,
      }
      bias = {
          "self_attn.q_proj": copy_and_view(self_attn_qb),
          "self_attn.k_proj": copy_and_view(self_attn_kb),
          "self_attn.v_proj": copy_and_view(self_attn_vb),
          "self_attn.out_proj": copy_and_view(self._get_weights(3)),
          "self_attn_layer_norm": copy_and_view(self._get_weights(5)),
          "encoder_attn.q_proj": copy_and_view(
              self._get_weights(7), (self.hs,)
          ),
          "encoder_attn.out_proj": copy_and_view(
              self._get_weights(9), (self.hs,)
          ),
          "encoder_attn_layer_norm": copy_and_view(
              self._get_weights(11), (self.hs,)
          ),
          "fc1": copy_and_view(self._get_weights(13)),
          "fc2": copy_and_view(self._get_weights(15)),
          "final_layer_norm": copy_and_view(self._get_weights(17)),
          "encoder_attn.k_proj": all_enc_attn_kb,
          "encoder_attn.v_proj": all_enc_attn_vb,
      }
      return weight, bias
  
imports: import __init__
  from itertools import zip_longest
  import copy
  import torch
  from torch import nn
  import math
  from dataclasses import dataclass
  from csrc.pytorch.layer_base import TransformerDecoderLayerBase
  from csrc.pytorch.util import copy_para, state_dict, calc_offset
  from csrc.pytorch.torch_transformer_layers import act_quant_config, weight_quant_config
  from csrc.pytorch.builder.cuda_layer_builder import CudaLayerBuilder
label_desc: Use image node_id 3 for calling the LSTransformerDecoderLayer obj's underlying member method code with example usage: obj.params_dict() and returns: weight,  bias, m, copy_and_view