itayhubara / BinaryNet.pytorch

Binarized Neural Network (BNN) for pytorch
504 stars 125 forks source link

code question about details #14

Open appleleaves opened 5 years ago

appleleaves commented 5 years ago

In the file main_binary.py line254, there is a attr as 'org' in p. What does it means and when is it assigned? I cannot find any clues from the whole project.

Enderdead commented 5 years ago

The key idea here is to compute the grad on real weight value. So he uses an intern parameter .org to save the real weight value during the forward pass. When he needs to apply the grad computed with binarized weight on the real weight value, he replaces binarized weight by the real one store on .org parameter.