mindspore.Tensor.std
- Tensor.std(axis=None, ddof=0, keepdims=False)[source]
Compute 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.,
.Return 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
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
, where represents the number of elements. Default: 0.keepdims – Default: False.
- Returns
Standard deviation tensor.
- Supported Platforms:
Ascend
GPU
CPU
See also
mindspore.Tensor.mean()
: Reduce a dimension of a tensor by averaging all elements in the dimension.mindspore.Tensor.var()
: Compute the variance along the specified axis.Examples
>>> import numpy as np >>> from mindspore import Tensor >>> input_x = Tensor(np.array([1, 2, 3, 4], dtype=np.float32)) >>> output = input_x.std() >>> print(output) 1.118034