megengine.module.init¶
>>> import megengine.module as M
>>> m = M.Conv2d(16, 33, 3, stride=2)
>>> M.init.msra_normal_(m.weight, mode="fan_out", nonlinearity="relu")
Note
良好的初始化策略有助于你的模型在训练时更快地收敛。
Initialization¶
Fills the given |
|
Fills the given |
|
Fills the given |
|
Fills the given |
|
Fills the given |
|
Returns a recommended gain value (see the table below) for the given nonlinearity function. |
|
Calculates fan_in / fan_out value for given weight tensor. |
|
Calculates fan_in / fan_out value for given weight tensor, depending on given |
|
Fills tensor with random values sampled from \(\mathcal{U}(-a, a)\) where |
|
Fills tensor with random values sampled from \(\mathcal{N}(0, \text{std}^2)\) where |
|
Fills tensor wilth random values sampled from \(\mathcal{U}(-\text{bound}, \text{bound})\) where |
|
Fills tensor wilth random values sampled from \(\mathcal{N}(0, \text{std}^2)\) where |