MCPcopy Create free account
hub / github.com/OpenGVLab/HumanBench / _init_weights

Method _init_weights

PATH/core/models/backbones/vit.py:437–444  ·  view source on GitHub ↗
(self, m)

Source from the content-addressed store, hash-verified

435 rescale(layer.mlp.fc2.weight.data, layer_id + 1)
436
437 def _init_weights(self, m):
438 if isinstance(m, nn.Linear):
439 trunc_normal_(m.weight, std=.02)
440 if isinstance(m, nn.Linear) and m.bias is not None:
441 nn.init.constant_(m.bias, 0)
442 elif isinstance(m, nn.LayerNorm):
443 nn.init.constant_(m.bias, 0)
444 nn.init.constant_(m.weight, 1.0)
445
446 @staticmethod
447 def _normalization(x):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected