Construct quantized Tensor from int_repr()

Dear pytorch community,
Given an integer representation and the affine transform, how do I create a corresponding torch.tensor object? The python tensor constructor seems to assume no quantization.
Thanks a lot for your help,

For posterity since I was looking here for the solution, if your main interest is in the original weight approximation one solution is to approximate the original weights manually:
restweights = (quant_ints - q_zero_point)*q_scale
This ‘hacky’ approach works for me since I was going to call dequantize anyway.

we do have some non-public API to do this: and

but they we might change the API when we officially release quantization as a stable feature.

1 Like