Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible bug in he_init function #29

Open
ngoyal2707 opened this issue Dec 31, 2018 · 0 comments
Open

Possible bug in he_init function #29

ngoyal2707 opened this issue Dec 31, 2018 · 0 comments

Comments

@ngoyal2707
Copy link

It seems that in the current version of master in the he_init function, gain is being passed for argument a.
But as per Pytorch code in both version 1.0 and 0.4.1, kaiming_normal_() expects a to be negative slope and has nonlinearity argument separately. So just following function call should do:

kaiming_normal(layer.weight, nonlinearity=nonlinearity, a=param) 

Pytorch source code link: https://github.com/pytorch/pytorch/blob/v0.4.1/torch/nn/init.py#L296

I have tested it on some layers, just above call gives the expected value to std() of layer.weight.

Your code might have been based on some different version of pytorch that did expect to pass gain separately but thought should you a heads up just in case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant