KaimingNormal

class paddle.nn.initializer. KaimingNormal ( fan_in=None ) [source]

Implements the Kaiming Normal initializer

This class implements the weight initialization from the paper Delving Deep into Rectifiers: Surpassing Human-Level Performance on ImageNet Classification by Kaiming He, Xiangyu Zhang, Shaoqing Ren and Jian Sun. This is a robust initialization method that particularly considers the rectifier nonlinearities.

In case of Normal distribution, the mean is 0 and the standard deviation is

\[\begin{split}\sqrt{\\frac{2.0}{fan\_in}}\end{split}\]
Parameters
  • fan_in (float32|None) – fan_in for Kaiming normal Initializer. If None, it is

  • from the variable. default is None. (inferred) –

Note

It is recommended to set fan_in to None for most cases.

Examples

import paddle
import paddle.nn as nn

linear = nn.Linear(2,
                   4,
                   weight_attr=nn.initializer.KaimingNormal())
data = paddle.rand([30, 10, 2], dtype='float32')
res = linear(data)