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

Method _init_weights

semantic_sam/backbone/focal_dw.py:557–564  ·  view source on GitHub ↗
(m)

Source from the content-addressed store, hash-verified

555 """
556
557 def _init_weights(m):
558 if isinstance(m, nn.Linear):
559 trunc_normal_(m.weight, std=.02)
560 if isinstance(m, nn.Linear) and m.bias is not None:
561 nn.init.constant_(m.bias, 0)
562 elif isinstance(m, nn.LayerNorm):
563 nn.init.constant_(m.bias, 0)
564 nn.init.constant_(m.weight, 1.0)
565
566 if isinstance(pretrained, str):
567 self.apply(_init_weights)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected