class_docstr: Linear layer with quantization aware training capability
class_docstr_tok: ["Linear","layer","with","quantization","aware","training","capability"]
code: def __init__(
      self,
      *args,
      activation_bits=8,
      requantize_output=True,
      ema_decay=0.9999,
      **kwargs,
  ):
      super().__init__(*args, **kwargs)
      if activation_bits < 2:
          raise ValueError(
              f"activation_bits={activation_bits} must be higher than 1 "
          )
      self.activation_bits = activation_bits
      self.accumulation_bits = 32
      self.ema_decay = ema_decay
      self.requantize_output = requantize_output
      self.register_buffer("input_thresh", torch.zeros(1))
      if self.requantize_output:
          self.register_buffer("output_thresh", torch.zeros(1))
      # real quantization
      if kwargs.get("bias", True):
          self.register_buffer("_quantized_bias", None)
          self.register_buffer("bias_scale", None)
  
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 QuantizedLinear object from inherited base classes: QuantizedLayer, nn with example: obj = QuantizedLinear()