class_docstr: Asymmetric quantization
docstr: Args:
      inputs (`torch.FloatTensor`)
          The input which needs to be quantized
      num_bits (int, >=4)
          Number of bits to use for quantization
      min_value/max_vlue (torch.FloatTensor)
          Used for static activation quantization
      num_groups (int)
          How many groups to partition the quantization into
  Returns:
      quantized_input (`torch.FloatTensor`)
          Quantized input
docstr_tok: ["Args",":","inputs","(","`","torch.FloatTensor","`",")","The","input","which","needs","to","be","quantized","num_bits","(","int",",",">","=4",")","Number","of","bits","to","use","for","quantization","min_value\/max_vlue","(","torch.FloatTensor",")","Used","for","static","activation","quantization","num_groups","(","int",")","How","many","groups","to","partition","the","quantization","into","Returns",":","quantized_input","(","`","torch.FloatTensor","`",")","Quantized","input"]
code: def forward(
      ctx, input, num_bits, min_value=None, max_value=None, num_groups=1
  ):
      """
      Args:
          inputs (`torch.FloatTensor`)
              The input which needs to be quantized
          num_bits (int, >=4)
              Number of bits to use for quantization
          min_value/max_vlue (torch.FloatTensor)
              Used for static activation quantization
          num_groups (int)
              How many groups to partition the quantization into
      Returns:
          quantized_input (`torch.FloatTensor`)
              Quantized input
      """
  
      assert (min_value is None and max_value is None) or (
          min_value is not None
          and max_value is not None
          and num_groups == 1
      )
      q_range = 2**num_bits
      input_shape = input.shape
      if min_value is None:
          input = input.reshape(num_groups, -1)
          min_value = input.amin(dim=-1, keepdim=True)
          max_value = input.amax(dim=-1, keepdim=True)
  
      scale = (max_value - min_value) / q_range
      zero_point = (min_value / scale).round() * scale
  
      output = ((input - zero_point) / scale).round().clamp(
          0, q_range - 1
      ) * scale + zero_point
      output = output.reshape(input_shape).contiguous()
      return output
  
imports: import torch
  from torch import autograd
  import math
label_desc: Use image node_id 1 for calling the AsymQuantizer obj's underlying member method code with example usage: obj.forward(ctx, input, num_bits, min_value, max_value, num_groups) and returns: output