MCPcopy Create free account
hub / github.com/VCIP-RGBD/DFormer / __init_weight

Function __init_weight

utils/init_func.py:7–15  ·  view source on GitHub ↗
(feature, conv_init, norm_layer, bn_eps, bn_momentum, **kwargs)

Source from the content-addressed store, hash-verified

5
6
7def __init_weight(feature, conv_init, norm_layer, bn_eps, bn_momentum, **kwargs):
8 for name, m in feature.named_modules():
9 if isinstance(m, (nn.Conv1d, nn.Conv2d, nn.Conv3d)):
10 conv_init(m.weight, **kwargs)
11 elif isinstance(m, norm_layer):
12 m.eps = bn_eps
13 m.momentum = bn_momentum
14 nn.init.constant_(m.weight, 1)
15 nn.init.constant_(m.bias, 0)
16
17
18def init_weight(module_list, conv_init, norm_layer, bn_eps, bn_momentum, **kwargs):

Callers 1

init_weightFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected