eladhoffer / quantized.pytorch

MIT License
212 stars 57 forks source link

Self.weight is not modified to qweight #12

Open aparna-aketi opened 3 years ago

aparna-aketi commented 3 years ago

Hi @eladhoffer @itayhubara, I see that in the quantize.py file, self.weight is left unchanged and qweight is only used to compute gradients. This results in the use of full precision weights for gradient update step (optimizer.step) which acts as error feedback and hence a less accuracy drop. When I add self.weight=qweight to QConv2d class's forward function, I see an accuracy drop of 15-20% for ResNet20 on CIFAR10. Does that mean we need a copy of the full precision weights and full precision weight update step or am I missing something? Any help would be highly appreciated!

Thanks, Aparna