Skip to content

Instantly share code, notes, and snippets.

@KushajveerSingh
Created April 19, 2019 08:41
Show Gist options
  • Save KushajveerSingh/c1f9a0a65cbf597a9c468203459fd26e to your computer and use it in GitHub Desktop.
Save KushajveerSingh/c1f9a0a65cbf597a9c468203459fd26e to your computer and use it in GitHub Desktop.
Using He initialization for conv model
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