The meaning of some fields in the state_dict of a quantized model

jensenchen: <p>Hello,<br>
I have a simple model,  trained and quantized using prepare_fx and conver_fx with qconfig fbqemm.<br>
Then I save it and reload it using load_state_dict and got an ordered dictionary.</p>
<p>The question is:  there are some unclear fileds in the dictionary,<br>
What are ‘a_input_scale_0’, ‘a_input_zero_point_0’, ‘a.scale’, 'a.zero_point '?   Since we noticed that a._packed_params._packed_params already contains scale and zero_point itself.<br>
And where is the bias ?</p>
<p>Any help is appreciated,  thank you</p>
<p>########   The model<br>
class myModel(nn.Module):<br>
def <strong>init</strong>(self):<br>
super().<strong>init</strong>()<br>
self.a = nn.Linear(32, 35, bias=True)<br>
self.b = nn.Linear(98, 1, bias=True)<br>
def forward(self, x):<br>
x = self.a(x)<br>
x = self.b(x.transpose(1, 2))<br>
x = x.view(x.size(0), -1)<br>
return x</p>
<h6><a name="p-461043-the-ouput-state_dict-of-quantized-model-1" class="anchor" href="#p-461043-the-ouput-state_dict-of-quantized-model-1"></a>The ouput state_dict of quantized model</h6>
<p>a_input_scale_0          tensor(0.0895)<br>
a_input_zero_point_0     tensor(67)<br>
a.scale          tensor(0.0581)<br>
a.zero_point     tensor(61)<br>
a._packed_params.dtype   torch.qint8<br>
a._packed_params._packed_params          (tensor([[ 0.1049, -0.0834,  0.0367,  …,  0.1226,  0.0114, -0.0518],<br>
[-0.0455, -0.0371, -0.0236,  …, -0.0337,  0.0017, -0.0303],<br>
[ 0.0721, -0.0401, -0.1162,  …, -0.1643,  0.0521,  0.1102],<br>
…,<br>
[-0.0614, -0.0341,  0.0034,  …, -0.0461,  0.0938, -0.0461],<br>
[ 0.0778, -0.0519, -0.2309,  …,  0.2543,  0.3295,  0.1142],<br>
[-0.0360, -0.0337, -0.0067,  …, -0.1887, -0.0584, -0.0831]],<br>
size=(35, 32), dtype=torch.qint8,<br>
quantization_scheme=torch.per_channel_affine,<br>
scale=tensor([0.0013, 0.0017, 0.0020, 0.0015, 0.0014, 0.0014, 0.0016, 0.0021, 0.0018,<br>
0.0021, 0.0018, 0.0018, 0.0021, 0.0018, 0.0014, 0.0018, 0.0024, 0.0017,<br>
0.0018, 0.0016, 0.0017, 0.0020, 0.0017, 0.0018, 0.0024, 0.0014, 0.0019,<br>
0.0018, 0.0021, 0.0017, 0.0015, 0.0018, 0.0017, 0.0026, 0.0022],<br>
dtype=torch.float64),<br>
zero_point=tensor([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,<br>
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]),<br>
axis=0), Parameter containing:<br>
tensor([-0.0608, -0.0085,  0.0056, -0.0036, -0.0117,  0.1390,  0.1868,  0.2030,<br>
-0.1790, -0.2360,  0.0027,  0.1740, -0.0881, -0.2767, -0.0704,  0.0934,<br>
-0.0325,  0.2201,  0.2068,  0.0948,  0.1345,  0.1555,  0.0917, -0.0823,<br>
-0.3508,  0.2088, -0.0425,  0.0863, -0.1298,  0.0901,  0.2117, -0.1644,<br>
-0.0104, -0.0356, -0.0740], requires_grad=True))<br>
b.scale          tensor(0.1606)<br>
b.zero_point     tensor(64)<br>
b._packed_params.dtype   torch.qint8<br>
b._packed_params._packed_params          (tensor([[ 0.1418,  0.0219,  0.1013, -0.0760, -0.0068, -0.0270, -0.0523,  0.0219,<br>
-0.1266, -0.0270, -0.0169, -0.1064, -0.1435, -0.0101, -0.0861, -0.1570,<br>
-0.0810, -0.0709, -0.1182, -0.1401, -0.0051, -0.1587, -0.1536, -0.0557,<br>
-0.0355, -0.1131, -0.1249, -0.0101, -0.0321, -0.1047, -0.0540, -0.0017,<br>
-0.0760, -0.0338, -0.0777,  0.0101,  0.0101, -0.0338,  0.0675,  0.0000,<br>
-0.0490,  0.0523,  0.0253, -0.0608,  0.0793,  0.0203,  0.0625, -0.0135,<br>
0.0388,  0.0658,  0.0523,  0.0388,  0.0743,  0.0338,  0.0152,  0.1418,<br>
0.0321,  0.1249,  0.0625,  0.0304,  0.1773,  0.0675,  0.0726,  0.0540,<br>
0.1891,  0.0979,  0.1705,  0.0743,  0.1013,  0.1519,  0.0709,  0.1688,<br>
0.1536,  0.0709,  0.1199,  0.1587,  0.1941,  0.1165,  0.1502,  0.1435,<br>
0.2144,  0.0709,  0.0996,  0.1519,  0.1688,  0.1367,  0.1722,  0.1199,<br>
0.1351,  0.1435,  0.1469,  0.0912,  0.1587,  0.0709,  0.1351,  0.0270,<br>
0.0236,  0.0945]], size=(1, 98), dtype=torch.qint8,<br>
quantization_scheme=torch.per_channel_affine,<br>
scale=tensor([0.0017], dtype=torch.float64), zero_point=tensor([0]),<br>
axis=0), Parameter containing:<br>
tensor([0.1705], requires_grad=True))</p>