Skip to content

Instantly share code, notes, and snippets.

@itsuncheng
Created July 26, 2020 03:54
Show Gist options
  • Select an option

  • Save itsuncheng/0b460eeaa936d55e874cc92bcc33f491 to your computer and use it in GitHub Desktop.

Select an option

Save itsuncheng/0b460eeaa936d55e874cc92bcc33f491 to your computer and use it in GitHub Desktop.
# custom weights initialization called on netG and netD
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