class_docstr: Quantizer defined in:
  Quantization and Training of Neural Networks for Efficient Integer-Arithmetic-Only Inference
  http://openaccess.thecvf.com/content_cvpr_2018/papers/Jacob_Quantization_and_Training_CVPR_2018_paper.pdf
docstr: Parameters
  ----------
  layer : LayerInfo
      the layer to quantize
  config_list : list of dict
      list of configurations for quantization
      supported keys for dict:
          - quant_types : list of string
              type of quantization you want to apply, currently support 'weight', 'input', 'output'
          - quant_bits : int or dict of {str : int}
              bits length of quantization, key is the quantization type, value is the length, eg. {'weight', 8},
              when the type is int, all quantization types share same bits length
          - quant_start_step : int
              disable quantization until model are run by certain number of steps, this allows the network to enter a more stable
              state where activation quantization ranges do not exclude a signiﬁcant fraction of values, default value is 0
          - op_types : list of string
              types of nn.module you want to apply quantization, eg. 'Conv2d'
docstr_tok: ["Parameters","--","--","--","--","--","layer",":","LayerInfo","the","layer","to","quantize","config_list",":","list","of","dict","list","of","configurations","for","quantization","supported","keys","for","dict",":","-","quant_types",":","list","of","string","type","of","quantization","you","want","to","apply",",","currently","support","'weight","'",",","'input","'",",","'output'","-","quant_bits",":","int","or","dict","of","{","str",":","int","}","bits","length","of","quantization",",","key","is","the","quantization","type",",","value","is","the","length",",","eg",".","{","'weight","'",",","8","}",",","when","the","type","is","int",",","all","quantization","types","share","same","bits","length","-","quant_start_step",":","int","disable","quantization","until","model","are","run","by","certain","number","of","steps",",","this","allows","the","network","to","enter","a","more","stable","state","where","activation","quantization","ranges","do","not","exclude","a","signi\ufb01cant","fraction","of","values",",","default","value","is","0","-","op_types",":","list","of","string","types","of","nn.module","you","want","to","apply","quantization",",","eg",".","'Conv2d","'"]
code: def __init__(self, model, config_list, optimizer=None):
      """
      Parameters
      ----------
      layer : LayerInfo
          the layer to quantize
      config_list : list of dict
          list of configurations for quantization
          supported keys for dict:
              - quant_types : list of string
                  type of quantization you want to apply, currently support 'weight', 'input', 'output'
              - quant_bits : int or dict of {str : int}
                  bits length of quantization, key is the quantization type, value is the length, eg. {'weight', 8},
                  when the type is int, all quantization types share same bits length
              - quant_start_step : int
                  disable quantization until model are run by certain number of steps, this allows the network to enter a more stable
                  state where activation quantization ranges do not exclude a signiﬁcant fraction of values, default value is 0
              - op_types : list of string
                  types of nn.module you want to apply quantization, eg. 'Conv2d'
      """
      super().__init__(model, config_list, optimizer)
      self.quant_grad = QATGrad
      modules_to_compress = self.get_modules_to_compress()
      self.bound_model.register_buffer("steps", torch.Tensor([1]))
      for layer, config in modules_to_compress:
          layer.module.register_buffer(
              "zero_point", torch.Tensor([0.0])
          )
          layer.module.register_buffer("scale", torch.Tensor([1.0]))
          if "output" in config.get("quant_types", []):
              layer.module.register_buffer(
                  "ema_decay", torch.Tensor([0.99])
              )
              layer.module.register_buffer(
                  "tracked_min_biased", torch.zeros(1)
              )
              layer.module.register_buffer(
                  "tracked_min", torch.zeros(1)
              )
              layer.module.register_buffer(
                  "tracked_max_biased", torch.zeros(1)
              )
              layer.module.register_buffer(
                  "tracked_max", torch.zeros(1)
              )
  
imports: import logging
  import copy
  import torch
  from schema import Schema, And, Or, Optional
  from ..utils.config_validation import CompressorSchema
  from ..compressor import Quantizer, QuantGrad, QuantType
label_desc: Use image node_id 1 to create a new QAT_Quantizer object from inherited base classes: Quantizer with example: obj = QAT_Quantizer(model, config_list, optimizer)