MCPcopy Create free account
hub / github.com/SLDGroup/EMCAD / initialize_weights

Function initialize_weights

utils/misc.py:16–25  ·  view source on GitHub ↗
(*models)

Source from the content-addressed store, hash-verified

14
15
16def initialize_weights(*models):
17 for model in models:
18 for module in model.modules():
19 if isinstance(module, nn.Conv2d) or isinstance(module, nn.Linear):
20 nn.init.kaiming_normal(module.weight)
21 if module.bias is not None:
22 module.bias.data.zero_()
23 elif isinstance(module, nn.BatchNorm2d):
24 module.weight.data.fill_(1)
25 module.bias.data.zero_()
26
27
28def get_upsampling_weight(in_channels, out_channels, kernel_size):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected