# mindspore.numpy.std¶

mindspore.numpy.std(x, axis=None, ddof=0, keepdims=False)[source]

Computes the standard deviation along the specified axis. The standard deviation is the square root of the average of the squared deviations from the mean, i.e., $$std = sqrt(mean(abs(x - x.mean())**2))$$.

Returns the standard deviation, which is computed for the flattened array by default, otherwise over the specified axis.

Note

Numpy arguments dtype, out and where are not supported.

Parameters
• x (Tensor) – A Tensor to be calculated.

• axis (Union[None, int, tuple(int)]) –

Axis or axes along which the standard deviation is computed. Default: None.

If None, compute the standard deviation of the flattened array.

• ddof (int) – Means Delta Degrees of Freedom. The divisor used in calculations is $$N - ddof$$, where $$N$$ represents the number of elements. Default: 0.

• keepdims – Default: False.

Returns

Standard deviation tensor.

Supported Platforms:

Ascend GPU CPU

Examples

>>> import mindspore.numpy as np
>>> input_x = np.array([1., 2., 3., 4.])
>>> output = np.std(input_x)
>>> print(output)
1.118034