GATECH-EIC / ShiftAddNet

[NeurIPS 2020] ShiftAddNet: A Hardware-Inspired Deep Network
MIT License
66 stars 18 forks source link

How is back propagation of shift layer implemented #3

Closed zbh2047 closed 3 years ago

zbh2047 commented 3 years ago

Hi,

I am really interested in your work and I think the proposed ShiftAddNet is really promising! However, it seems that there is some mismatch of the implementation and the paper. I find that the shift layer is implemented using a convolution in your code (in resnet_shiftadd.py). In fact, I really want to know the implementation details of back propagation of shift layer, since the weights of shift layer (i.e. s and p) should be integers which are not continuous variables. But I havn't find the code for back propagation of shift layer yet. Hope you can help me and correct me if I understand it wrong. Thank you very much!

ranery commented 3 years ago

Thanks for your interest, I'd love to answer your question!

You can see in the main script that we have the option to change the defined convolutional layers to shift layers, https://github.com/RICE-EIC/ShiftAddNet/blob/main/train.py#L218 where the conversion is following the default format in DeepShift and the shift kernel is defined at https://github.com/RICE-EIC/ShiftAddNet/blob/main/deepshift/modules.py#L313

Hope that can solve your issue and feel free to let me know if you have any other questions.

zbh2047 commented 3 years ago

I completely understand. Thank you!