brevitas icon indicating copy to clipboard operation
brevitas copied to clipboard

Error when using IntQuant

Open juliovicenzi opened this issue 2 years ago • 0 comments

When creating my own integer quantizer, I get the following error:

TypeError: forward() missing 3 required positional arguments: 'zero_point', 'bit_width', and 'x'

Using this quantizer:

class ActInt(ExtendedInjector):
    tensor_quant = IntQuant
    bit_width = 3
    narrow_range = True
    zero_point_impl = ZeroZeroPoint
    signed = True
    proxy_class = ActQuantProxyFromInjector

And running this test:

quant = QuantIdentity(act_quant=ActInt)
x = torch.Tensor([-1, 2, 3])
y = quant(x)
print(y, y.is_valid)

Python version 3.6.9 and Brevitas 0.7.1

Is anything missing for my quantizer class? Usually I've encountered that the dependencies library throws an error if the given quantizer is not valid, but in this case an exception is thrown during the forward operation.

juliovicenzi avatar Mar 24 '22 16:03 juliovicenzi