normal_

paddle. normal_ ( x: Tensor, mean: complex = 0.0, std: float = 1.0, name: str | None = None ) Tensor [source]

This is the inplace version of api normal, which returns a Tensor filled with random values sampled from a normal distribution. The output Tensor will be inplaced with input x. Please refer to normal.

Parameters
  • x (Tensor) – The input tensor to be filled with random values.

  • mean (float|int|complex, optional) – Mean of the output tensor, default is 0.0.

  • std (float|int, optional) – Standard deviation of the output tensor, default is 1.0.

  • name (str|None, optional) – The default value is None. Normally there is no need for user to set this property. For more information, please refer to Name.

Returns

Tensor, A Tensor filled with random values sampled from a normal distribution with mean and std .

Examples

>>> import paddle
>>> x = paddle.randn([3, 4])
>>> x.normal_()
>>> 
>>> print(x)
Tensor(shape=[3, 4], dtype=float32, place=Place(cpu), stop_gradient=True,
[[ 0.06132207,  1.11349595,  0.41906244, -0.24858207],
 [-1.85169315, -1.50370061,  1.73954511,  0.13331604],
 [ 1.66359663, -0.55764782, -0.59911072, -0.57773495]])