How to print the weight after torch.quantization.convert?

I use the QAT method provided by Pytorch. After using the torch.quantization.convert, I can’t get the weight when print(model.conv.weight), I get the message bellow:
“<bound method Conv2d.weight of QuantizedConv2d(16, 16, kernel_size=(3, 3), stride=(1, 1), scale=1.0, zero_point=0, padding=(1, 1), groups=16, bias=False)>”

How to print the weight after torch.quantization.convert?
Thanks!

1 Like

this is the solution!

OK. It seems like we can use
layer[0].weight().int_repr().data
to get the INT8 representation of the weight entries.

Also,
layer[0].weight().dequantize()
gives the tensor of the weights in FP format to have element-wise access to its contents.