Could not run 'aten::int_repr' with arguments from the 'CPU' backend

I want to get the int value of each weight in the quantized model, using int_repr(), but I get a RuntimeError
this is code

for weight in myModel.state_dict():
if “weight” in weight:
m = myModel.state_dict()[weight].int_repr()
print(m)

RuntimeError: Could not run ‘aten::int_repr’ with arguments from the ‘CPU’ backend. ‘aten::int_repr’ is only available for these backends: [QuantizedCPU, Autograd, Profiler, Tracer].

I have the same issue did you solve your problem ?

This error message that you are trying to call int_repr() on a weight that is not quantized. That function is only supported for quantized weights. You could try checking if that function exists and only calling it if does.

1 Like