MCPcopy Create free account
hub / github.com/Colin97/DeepMetaHandles / weights_init1

Function weights_init1

src/utils.py:13–19  ·  view source on GitHub ↗
(m)

Source from the content-addressed store, hash-verified

11 torch.nn.init.constant_(m.bias.data, 0.0)
12
13def weights_init1(m):
14 classname = m.__class__.__name__
15 if classname.find('Conv') != -1:
16 torch.nn.init.normal_(m.weight.data, 0.0, 0.02)
17 elif classname.find('BatchNorm') != -1:
18 torch.nn.init.normal_(m.weight.data, 1.0, 0.02)
19 torch.nn.init.constant_(m.bias.data, 0)
20
21def bn_momentum_adjust(m, momentum):
22 if isinstance(m, torch.nn.BatchNorm2d) or isinstance(m, torch.nn.BatchNorm1d):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected