Created
April 19, 2019 08:41
-
-
Save KushajveerSingh/c1f9a0a65cbf597a9c468203459fd26e to your computer and use it in GitHub Desktop.
Using He initialization for conv model
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def weights_init(m): | |
classname = m.__class__.__name__ | |
if classname.find('Conv') != -1: | |
nn.init.normal_(m.weight.data, 0.0, 0.02) | |
elif classname.find('BatchNorm') != -1: | |
nn.init.normal_(m.weight.data, 1.0, 0.02) | |
nn.init.constant_(m.bias.data, 0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment