models/quant/quantizer.py
def linear_quantize(input, scale, zero_point, inplace=False):
    """
    Linearly quantize the input tensor based on scale and zero point.
    https://pytorch.org/docs/stable/quantization.html
    """
    if inplace:
        input.mul_(scale).sub_(zero_point).round_()
        return input
    # print(scale)
    return torch.round(input * scale - zero_point)

    Linearly quantize the input tensor based on scale and zero point.
    https://pytorch.org/docs/stable/quantization.html
    
Linearly quantize the input tensor based on scale and zero point.
Linearly quantize the input tensor based on scale and zero point .
def linear_quantize(input, scale, zero_point, inplace=False):
    if inplace:
        input.mul_(scale).sub_(zero_point).round_()
        return input
    return torch.round(input * scale - zero_point)
def linear_quantize ( input , scale , zero_point , inplace = False ) : if inplace : input . mul_ ( scale ) . sub_ ( zero_point ) . round_ ( ) return input return torch . round ( input * scale - zero_point )
Linearly quantize the input tensor based on scale and zero point.
Linearly quantize the input tensor based on scale and zero point .
"""
    Linearly quantize the input tensor based on scale and zero point.
    https://pytorch.org/docs/stable/quantization.html
    """ # print(scale)
input
scale
zero_point
inplace