mindspore/docs/api/api_python/ops/mindspore.ops.func_std.rst

26 lines
1.8 KiB
ReStructuredText
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

mindspore.ops.std
==================
.. py:function:: mindspore.ops.std(input_x, axis=(), unbiased=True, keep_dims=False)
默认情况下输出Tensor各维度上的标准差与均值也可以对指定维度求标准差与均值。如果 `axis` 是维度列表,则计算对应维度的标准差与均值。
参数:
- **input_x** (Tensor[Number]) - 输入Tensor其数据类型为数值型。shape :math:`(N, *)` ,其中 :math:`*` 表示任意数量的附加维度。秩应小于8。
- **axis** (Union[int, tuple(int), list(int)]) - 要减少的维度。默认值: (),缩小所有维度。只允许常量值。假设 `input_x` 的秩为r取值范围[-r,r)。
- **unbiased** (bool) - 如果为True使用Bessel校正。否则不使用Bessel校正。默认值True。
- **keep_dims** (bool) - 如果为True则保留缩小的维度大小为1。否则移除维度。默认值False。
返回:
Tuple含有两个Tensor的tuple分别为标准差与均值.
假设输入 `input_x` 的shape为 :math:`(x_0, x_1, ..., x_R)`
- 如果 `axis` 为(),且 `keep_dims` 为False则输出一个0维Tensor表示输入Tensor `input_x` 中所有元素的标准差。
- 如果 `axis` 为int取值为1并且 `keep_dims` 为False则输出的shape为 :math:`(x_0, x_2, ..., x_R)`
- 如果 `axis` 为tuple(int)或list(int),取值为(1, 2),并且 `keep_dims` 为False则输出Tensor的shape为 :math:`(x_0, x_3, ..., x_R)`
异常:
- **TypeError** - `input_x` 不是Tensor。
- **TypeError** - `axis` 不是以下数据类型之一int、tuple或list。
- **TypeError** - `keep_dims` 不是bool类型。
- **ValueError** - `axis` 超出范围。