code: def __init__(self, config):
      super().__init__()
      if (
          config.hidden_size % config.num_attention_heads != 0
          and not hasattr(config, "embedding_size")
      ):
          raise ValueError(
              "The hidden size (%d) is not a multiple of the number of attention "
              "heads (%d)"
              % (config.hidden_size, config.num_attention_heads)
          )
      self.output_attentions = config.output_attentions
  
      self.num_attention_heads = config.num_attention_heads
      self.attention_head_size = int(
          config.hidden_size / config.num_attention_heads
      )
      self.all_head_size = (
          self.num_attention_heads * self.attention_head_size
      )
  
      # Quantized implementations of torch.nn.Linear modules
      self.query = quant_nn.QuantLinear(
          config.hidden_size, self.all_head_size
      )
      self.key = quant_nn.QuantLinear(
          config.hidden_size, self.all_head_size
      )
      self.value = quant_nn.QuantLinear(
          config.hidden_size, self.all_head_size
      )
  
      self.dropout = nn.Dropout(config.attention_probs_dropout_prob)
  
      # Additional quantizers that will be needed to quantize the inputs to the torch.matmul() operation in the
      # forward method. Since it's a simple operation and no quantized version of it exists, the inputs to this
      # operation could be manually quantized to realize a quantized mat-mul operation.
      self.matmul_q_input_quantizer = TensorQuantizer(
          quant_nn.QuantLinear.default_quant_desc_input
      )
      self.matmul_k_input_quantizer = TensorQuantizer(
          quant_nn.QuantLinear.default_quant_desc_input
      )
      self.matmul_v_input_quantizer = TensorQuantizer(
          quant_nn.QuantLinear.default_quant_desc_input
      )
      self.matmul_a_input_quantizer = TensorQuantizer(
          quant_nn.QuantLinear.default_quant_desc_input
      )
  
file_path: lightseq/lightseq/training/pytorch_quantization/nn/modules/quant_bert.py
imports: import math
  import torch
  from torch import nn
  from lightseq.training.pytorch_quantization import nn
  from lightseq.training.pytorch_quantization.nn.modules.tensor_quantizer import TensorQuantizer
label_desc: Use image node_id 1 to create a new QuantBertSelfAttention object from inherited base classes: nn with example: obj = QuantBertSelfAttention(config)