megengine.module.init.msra_uniform_

msra_uniform_(tensor, a=0, mode='fan_in', nonlinearity='leaky_relu')[源代码]

使用 \(\mathcal{U}(-\text{bound}, \text{bound})\) 的随机采样值填入 tensor

\[\text{bound} = \sqrt{\frac{6}{(1 + a^2) \times \text{fan_in}}}\]

参考 “Delving deep into rectifiers: Surpassing human-level performance on ImageNet classification” 获取详细说明

参数
  • tensor (Tensor) – 待初始化的n维张量。

  • a (float) – 用于计算leaky_relu增益的可选参数。请参阅: calculate_gain 了解详情。

  • mode (str) – `` ‘fan_in’`` 或 ' fan_out' ,用于计算 \(gain\) ,为 \(bound\) 的比例因子。请参阅: calculate_fan_in_and_fan_out 了解详情。

  • nonlinearity (str) – 用于计算 \(gain\) 的非线性函数的名称。请参阅 calculate_gain 了解详情。

返回类型

None