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

Function c2_msra_fill

PATH/core/models/ops/utils.py:117–129  ·  view source on GitHub ↗

Initialize `module.weight` using the "MSRAFill" implemented in Caffe2. Also initializes `module.bias` to 0. Args: module (torch.nn.Module): module to initialize.

(module: nn.Module)

Source from the content-addressed store, hash-verified

115
116
117def c2_msra_fill(module: nn.Module) -> None:
118 """
119 Initialize `module.weight` using the "MSRAFill" implemented in Caffe2.
120 Also initializes `module.bias` to 0.
121
122 Args:
123 module (torch.nn.Module): module to initialize.
124 """
125 nn.init.kaiming_normal_(module.weight, mode="fan_out", nonlinearity="relu")
126 if module.bias is not None:
127 # pyre-fixme[6]: Expected `Tensor` for 1st param but got `Union[nn.Module,
128 # torch.Tensor]`.
129 nn.init.constant_(module.bias, 0)
130
131
132def cat(tensors: List[torch.Tensor], dim: int = 0):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected