class_docstr: Initialize the Lightseq Transformer Encoder 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 TransformerEncoderLayer 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","Encoder","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","TransformerEncoderLayer","config",",","see","get_config","initial_weights",":","Optional",":","Only","used","for","unit","test","initial_biases",":","Optional",":","Only","used","for","unit","test"]
code: def assign_layer_weight_grad(self):
      if self.assigned_layer_weight_grad == True:
          return
      self.assigned_layer_weight_grad = True
      param = (
          self.para_16
          if self.config.fp16 and self.para.dtype != torch.half
          else self.para
      )
      if self.config.layer_id in _all_layer_grads:
          return
      global transformer_cuda_module
      cuda_module = cuda_layer_module
      if self.config.fp16:
          func = cuda_module.assign_layer_weight_grad_fp16
      else:
          func = cuda_module.assign_layer_weight_grad_fp32
      grad = torch.empty_like(param)
      func(param, grad, "TransformerEncoderLayer", self.config.layer_id)
      _all_layer_grads[self.config.layer_id] = grad
  
imports: import __init__
  import copy
  import torch
  import math
  from dataclasses import dataclass
  from csrc.pytorch.layer_base import TransformerEncoderLayerBase
  from csrc.pytorch.util import copy_para, state_dict, calc_offset
  from csrc.pytorch.builder.cuda_layer_builder import CudaLayerBuilder
label_desc: Use image node_id 6 for calling the LSTransformerEncoderLayer obj's underlying member method code with example usage: obj.assign_layer_weight_grad() without return types