Eric-mingjie / network-slimming

Network Slimming (Pytorch) (ICCV 2017)
MIT License
907 stars 214 forks source link

BN weight not in model.parameters() #18

Closed rayhou0710 closed 5 years ago

rayhou0710 commented 5 years ago

https://github.com/Eric-mingjie/network-slimming/blob/98e6b4d28e9909eff22ce4c45cba1b605cac9d65/main.py#L126

Hello, thank you for sharing the code.

I tried to reimplement your approach but found that the weights of nn.batchnorm2d are not in model.parameters() so the optimizer won't update them. Also, the function updateBN() doesn't work as in "m.weight.grad.data.add_(...)" weight.grad is NoneType.

Could you share how you resolved this or I missed something? Thanks!