MCPcopy Create free account
hub / github.com/SooLab/CGFormer / _init_weights

Method _init_weights

model/backbone.py:445–452  ·  view source on GitHub ↗
(m)

Source from the content-addressed store, hash-verified

443 """
444
445 def _init_weights(m):
446 if isinstance(m, nn.Linear):
447 trunc_normal_(m.weight, std=.02)
448 if isinstance(m, nn.Linear) and m.bias is not None:
449 nn.init.constant_(m.bias, 0)
450 elif isinstance(m, nn.LayerNorm):
451 nn.init.constant_(m.bias, 0)
452 nn.init.constant_(m.weight, 1.0)
453
454 if isinstance(pretrained, str):
455 self.apply(_init_weights)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected