allenai / XNOR-Net

ImageNet classification using binary Convolutional Neural Networks
https://xnor.ai/
Other
856 stars 239 forks source link

Questions about the updateBinaryGradWeight function #9

Open Pluto1944 opened 8 years ago

Pluto1944 commented 8 years ago

Hi, thanks for your excellent work. I am reading your code for a better understanding of the paper and I have two questions about the updateBinaryGradWeight function. I guess this function deals with the formula of “∂C/∂Wi = ∂C/∂W'i_(1/n+((∂sign/∂Wi)_alpha))" in the third paragraph on page 6. I can match the code with this formula except the "1-1/s[2]". What does it mean? To figure out this question I write a test and now I have anther problem unfortunately : ). Here is my code and the result.

local x = torch.Tensor(2,1):fill(1); local y = x:expand(2,10); y:add(1); print(y)

11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 [torch.DoubleTensor of size 2x10]

It seems like there may be something wrong when I use add() or mul() after expand(). Is there anything wrong with the way I understand the code?

mrastegari commented 8 years ago

please see the discussion here: #3