class_docstr: Quantizes the given activation.
  
  Args:
      activation_bit (`int`):
          Bitwidth for the quantized activation.
      act_range_momentum (`float`, *optional*, defaults to `0.95`):
          Momentum for updating the activation quantization range.
      per_channel (`bool`, *optional*, defaults to `False`):
          Whether to or not use channel-wise quantization.
      channel_len (`int`, *optional*):
          Specify the channel length when set the *per_channel* True.
      quant_mode (`bool`, *optional*, defaults to `False`):
          Whether or not the layer is quantized.
class_docstr_tok: ["Quantizes","the","given","activation",".","Args",":","activation_bit","(","`","int","`",")",":","Bitwidth","for","the","quantized","activation",".","act_range_momentum","(","`","float","`",",","*","optional","*",",","defaults","to","`","0.95","`",")",":","Momentum","for","updating","the","activation","quantization","range",".","per_channel","(","`","bool","`",",","*","optional","*",",","defaults","to","`","False","`",")",":","Whether","to","or","not","use","channel-wise","quantization",".","channel_len","(","`","int","`",",","*","optional","*",")",":","Specify","the","channel","length","when","set","the","*","per_channel","*","True",".","quant_mode","(","`","bool","`",",","*","optional","*",",","defaults","to","`","False","`",")",":","Whether","or","not","the","layer","is","quantized","."]
code: def __init__(
      self,
      activation_bit,
      act_range_momentum=0.95,
      per_channel=False,
      channel_len=None,
      quant_mode=False,
  ):
      super().__init__()
  
      self.activation_bit = activation_bit
      self.act_range_momentum = act_range_momentum
      self.quant_mode = quant_mode
      self.per_channel = per_channel
      self.percentile = False
      self.act_function = SymmetricQuantFunction.apply
  
      if not self.per_channel:
          self.register_buffer("x_min", torch.zeros(1))
          self.register_buffer("x_max", torch.zeros(1))
          self.register_buffer("act_scaling_factor", torch.zeros(1))
          self.x_min -= 1e-5
          self.x_max += 1e-5
      else:
          raise NotImplementedError(
              "per-channel mode is not currently supported for activation."
          )
  
imports: import decimal
  import numpy
  import torch
  from torch import nn
  from torch.autograd import Function
  from ...utils import logging
label_desc: Use image node_id 1 to create a new QuantAct object from inherited base classes: nn with example: obj = QuantAct(activation_bit, act_range_momentum, per_channel, channel_len, quant_mode)