MCPcopy Create free account
hub / github.com/alinlab/SelfPatch / _init_weights

Method _init_weights

selfpatch_vision_transformer.py:383–387  ·  view source on GitHub ↗
(self, m)

Source from the content-addressed store, hash-verified

381 self.embed_dim = in_dim
382
383 def _init_weights(self, m):
384 if isinstance(m, nn.Linear):
385 trunc_normal_(m.weight, std=.02)
386 if isinstance(m, nn.Linear) and m.bias is not None:
387 nn.init.constant_(m.bias, 0)
388
389 def forward(self, x, loc=False):
390 cls_tokens = self.cls_token.expand(x.shape[0], -1, -1)

Callers

nothing calls this directly

Calls 1

trunc_normal_Function · 0.90

Tested by

no test coverage detected