class_docstr: Initialize the Lightseq Quant Linear Layer.
  
  Static variable:
      layer_id: The layer-index counter starting from 0 and incrementing by 1 every time a layer object is instantiated,
  Arguments:
      config: An object of LSQuantLinearLayer config, see get_config
class_docstr_tok: ["Initialize","the","Lightseq","Quant","Linear","Layer",".","Static","variable",":","layer_id",":","The","layer-index","counter","starting","from","0","and","incrementing","by","1","every","time","a","layer","object","is","instantiated",",","Arguments",":","config",":","An","object","of","LSQuantLinearLayer","config",",","see","get_config"]
code: def __init__(
      self,
      config,
  ):
      super(LSQuantLinearLayer, self).__init__()
      self.config = config
      self.config.layer_id = LSQuantLinearLayer.layer_id
      LSQuantLinearLayer.layer_id += 1
  
      self.quant_mode = False
  
      if self.config.local_rank >= 0:
          torch.cuda.set_device(self.config.local_rank)
  
      self.weight = nn.Parameter(
          torch.empty(
              (self.config.out_features, self.config.in_features),
          )
      )
      if self.config.bias:
          self.bias = nn.Parameter(
              torch.empty(
                  self.config.out_features,
              )
          )
      else:
          self.register_parameter("bias", None)
  
      self.register_buffer("clip_max", torch.empty((3,)))
      self.reset_parameters()
  
      # Load cuda modules if needed
      global transformer_cuda_module
      if transformer_cuda_module is None:
          transformer_cuda_module = TransformerBuilder().load()
  
      # create the layer in cuda kernels.
      cuda_module = transformer_cuda_module
      create_layer_func = (
          cuda_module.create_quant_linear_layer_fp16
          if self.config.fp16
          else cuda_module.create_quant_linear_layer_fp32
      )
  
      create_layer_func(
          self.config.layer_id,
          self.config.in_features,
          self.config.out_features,
          self.config.max_batch_tokens,
      )
  
imports: from dataclasses import dataclass
  import math
  import torch
  from torch import nn
  from torch.autograd import Function
  from torch.nn import functional
  from lightseq.training.ops.pytorch.quantization import weight_quant_config, act_quant_config
  from lightseq.training.ops.pytorch.builder import TransformerBuilder
label_desc: Use image node_id 1 to create a new LSQuantLinearLayer object from inherited base classes: nn with example: obj = LSQuantLinearLayer(config)