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 LSTransformerEncoderLayer 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","LSTransformerEncoderLayer","config",",","see","get_config","initial_weights",":","Optional",":","Only","used","for","unit","test","initial_biases",":","Optional",":","Only","used","for","unit","test"]
code: def __init__(self, config, initial_weights=None, initial_biases=None):
      super(LSTransformerEncoderLayer, self).__init__()
  
      self.config = copy.deepcopy(config)
      self.config.layer_id = LSTransformerEncoderLayer.layer_id
      LSTransformerEncoderLayer.layer_id = (
          LSTransformerEncoderLayer.layer_id + 1
      )
  
      print("Lightseq Transformer config is ", self.config.__dict__)
  
      self.quant_mode = False
  
      if self.config.local_rank >= 0:
          torch.cuda.set_device(self.config.local_rank)
  
      self.create_cpp_layer()
  
      hs = self.config.hidden_size
      ims = self.config.intermediate_size
      self.hs = hs
      self.ims = ims
      self.para_offset = LSTransformerEncoderLayer.gen_offset(hs, ims)
      self.para = nn.Parameter(torch.Tensor(self.para_offset[-1]))
  
      if initial_weights is None or initial_biases is None:
          self.init_transformer_weights()
          return
  
      # For testing only.
      qkv_w = [ele.detach().clone() for ele in initial_weights[:3]]
      qkv_w = torch.cat(qkv_w, dim=0)
      weights = [qkv_w] + [
          copy_para(ele) for ele in initial_weights[3:]
      ]
  
      qkv_b = [ele.detach().clone() for ele in initial_biases[:3]]
      qkv_b = torch.cat(qkv_b, dim=0)
      biases = [qkv_b] + [copy_para(ele) for ele in initial_biases[3:]]
  
      idx = 0
      for w, b in zip_longest(weights, biases):
          if w is not None:
              cur_para = self._get_weights(idx)
              assert cur_para.numel() == w.numel()
              cur_para.copy_(w.view(-1))
              idx += 1
  
          if b is not None:
              cur_para = self._get_weights(idx)
              assert cur_para.numel() == b.numel()
              cur_para.copy_(b.view(-1))
              idx += 1
  
imports: from itertools import zip_longest
  import math
  import copy
  import torch
  from torch import nn
  from torch.autograd import Function
  from lightseq.training.ops.pytorch.layer_base import TransformerEncoderLayerBase
  from lightseq.training.ops.pytorch.builder import TransformerBuilder
  from lightseq.training.ops.pytorch.quantization import weight_quant_config, act_quant_config, relu_quant_config
  from lightseq.training.ops.pytorch.util import copy_para, state_dict, calc_offset
label_desc: Use image node_id 1 to create a new LSTransformerEncoderLayer object from inherited base classes: TransformerEncoderLayerBase with example: obj = LSTransformerEncoderLayer(config, initial_weights, initial_biases)