class_docstr: Quantized Layer interface
class_docstr_tok: ["Quantized","Layer","interface"]
code: def __init__(
      self, *args, weight_bits=8, start_step=0, mode="none", **kwargs
  ):
      if weight_bits < 2:
          raise ValueError(
              f"weight_bits={weight_bits} must be higher than 1 "
          )
      super().__init__(*args, **kwargs)
      self.weight_bits = weight_bits
      self.mode = QuantizationMode[mode.upper()]
      self.start_step = start_step
      self.register_buffer("_step", torch.zeros(1))
      # buffers for inference
      self.register_buffer("quantized_weight", None)
      self.register_buffer("_weight_scale", None)
      # handle import and export in 8bit
      self.mode_8bit = False
      self._imported_from_quantized = False
      # register saving hook
      self._register_state_dict_hook(self._state_dict_hook)
  
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  from enum import Enum, auto
  import logging
  from abc import ABC, abstractmethod
  import torch
  from torch import nn
  from torch.nn import functional
  from nlp_architect.common import Config
label_desc: Use image node_id 1 to create a new QuantizedLayer object from inherited base classes: ABC with example: obj = QuantizedLayer()