I modified the quantized weights of a net post-quantization as follows:
# instantiate the quantized net (not shown here). # get one of the conv layers tmp = model_int8.state_dict()['features.0.weight'] scales = tmp.q_per_channel_scales() zero_pts = tmp.q_per_channel_zero_points() axis = tmp.q_per_channel_axis() # get int repr tmp_int8 = tmp.int_repr() # change value (value change is dependent on the int8 value) tmp_int8 = new_value # how to convert tmp_int8 to torch.qint8 type? new_tmp = torch._make_per_channel_quantized_tensor(tmp_int8, scales, zero_pts, axis) # based on the above step: model_int8.features.weight = new_tmp
model_int8.features.weight shows updated values, but
model_int8.state_dict()['features.0.weight'] shows old vales.
I also tried saving the modified model and reloading, but the problem persists.
Question is which weight values are being used for inference? I do not see change in the classification results.