MCPcopy Create free account
hub / github.com/pytorch/tutorials / weights_init

Function weights_init

beginner_source/dcgan_faces_tutorial.py:292–298  ·  view source on GitHub ↗
(m)

Source from the content-addressed store, hash-verified

290
291# custom weights initialization called on ``netG`` and ``netD``
292def weights_init(m):
293 classname = m.__class__.__name__
294 if classname.find('Conv') != -1:
295 nn.init.normal_(m.weight.data, 0.0, 0.02)
296 elif classname.find('BatchNorm') != -1:
297 nn.init.normal_(m.weight.data, 1.0, 0.02)
298 nn.init.constant_(m.bias.data, 0)
299
300
301######################################################################

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected