MCPcopy Create free account
hub / github.com/UX-Decoder/Semantic-SAM / _init_weights

Method _init_weights

semantic_sam/backbone/focal.py:460–467  ·  view source on GitHub ↗
(m)

Source from the content-addressed store, hash-verified

458 """
459
460 def _init_weights(m):
461 if isinstance(m, nn.Linear):
462 trunc_normal_(m.weight, std=.02)
463 if isinstance(m, nn.Linear) and m.bias is not None:
464 nn.init.constant_(m.bias, 0)
465 elif isinstance(m, nn.LayerNorm):
466 nn.init.constant_(m.bias, 0)
467 nn.init.constant_(m.weight, 1.0)
468
469 if isinstance(pretrained, str):
470 self.apply(_init_weights)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected