XavierNormal¶

class paddle.nn.initializer. XavierNormal ( fan_in=None, fan_out=None, name=None ) [source]

This class implements the Xavier weight initializer from the paper Understanding the difficulty of training deep feedforward neural networks by Xavier Glorot and Yoshua Bengio, using a normal distribution whose mean is $$0$$ and standard deviation is

$\sqrt{\frac{2.0}{fan\_in + fan\_out}}.$
Parameters
• fan_in (float, optional) – fan_in for Xavier initialization, which is inferred from the Tensor. The default value is None.

• fan_out (float, optional) – fan_out for Xavier initialization, which is inferred from the Tensor. The default value is None.

• name (str, optional) – For details, please refer to Name. Generally, no setting is required. Default: None.

Returns

A parameter initialized by Xavier weight, using a normal distribution.

Examples

import paddle

data = paddle.ones(shape=[3, 1, 2], dtype='float32')
name="linear_weight",