itayhubara / BinaryNet.pytorch

Binarized Neural Network (BNN) for pytorch
505 stars 126 forks source link

Can the code be used for 01 activation? #31

Open yxy1995123 opened 2 years ago

yxy1995123 commented 2 years ago

I wonder this code can be used for outputing only 0 or 1 for weights?How

lollopes commented 2 years ago

I have the same question. I am confused why in the paper it is written that the sign function is used but the hardtanh is used in the implementation

itayhubara commented 1 year ago

the paper and code used the sign function for forward propagation and hardtanh for backward to preserve the gradient. This is the straight-through estimator.