vis4d.op.layer.weight_init
Model weight initialization.
Functions
|
Initialize conv/fc bias value according to a given probability value. |
|
Initialize module with constant value. |
|
Initialize module with Kaiming initialization. |
|
Initialize module with normal distribution. |
|
Initialize module with uniform distribution. |
|
Initialize module with Xavier initialization. |
- constant_init(module, val, bias=0.0)[source]
Initialize module with constant value.
- Return type:
None
- xavier_init(module, gain=1.0, bias=0.0, distribution='normal')[source]
Initialize module with Xavier initialization.
- Return type:
None
- kaiming_init(module, negative_slope=0.0, mode='fan_out', nonlinearity='relu', bias=0.0, distribution='normal')[source]
Initialize module with Kaiming initialization.
- Parameters:
module (nn.Module) – Module to initialize.
negative_slope (float, optional) – The negative slope of the rectifier used after this layer (only used with
'leaky_relu'). Defaults to 0.0.mode (FanMode, optional) – Either “fan_in” (default) or “fan_out”`. Choosing “fan_in” preserves the magnitude of the variance of the weights in the forward pass. Choosing “fan_out” preserves magnitudes in the backwards pass. Defaults to “fan_out”.
nonlinearity (NonlinearityType, optional) – The non-linear function (nn.functional name). Defaults to “relu”.
bias (float, optional) – The bias to use. Defaults to 0.0.
distribution (str, optional) – Either
'uniform'or'normal'. Defaults to “normal”.
- Return type:
None
- normal_init(module, mean=0.0, std=1.0, bias=0)[source]
Initialize module with normal distribution.
- Return type:
None