normal_¶
- paddle. normal_ ( x, mean=0.0, std=1.0, name=None ) [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 inputx
. Please refer to api_tensor_normal.- Parameters
-
x (Tensor) – The input tensor to be filled with random values.
mean (float|Tensor, optional) – The mean of the output Tensor’s normal distribution. If
mean
is float, all elements of the output Tensor shared the same mean. Ifmean
is a Tensor(data type supports float32, float64), it has per-element means. Default is 0.0std (float|Tensor, optional) – The standard deviation of the output Tensor’s normal distribution. If
std
is float, all elements of the output Tensor shared the same standard deviation. Ifstd
is a Tensor(data type supports float32, float64), it has per-element standard deviations. Default is 1.0name (str, 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
-
A Tensor filled with random values sampled from a normal distribution with
mean
andstd
.
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]])