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

34 lines
1.7 KiB
ReStructuredText
Raw Permalink 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.ReduceAny
=========================
.. py:class:: mindspore.ops.ReduceAny(keep_dims=False)
默认情况下通过对指定维度所有元素进行逻辑或运算来移除该维度。也可仅缩小该维度大小至1。 `keep_dims` 控制输出和输入的维度是否相同。
.. note::
Tensor类型的 `axis` 仅用作兼容旧版本,不推荐使用。
参数:
- **keep_dims** (bool可选) - 如果为 ``True`` 则保留缩小的维度大小为1。否则移除维度。默认值 ``False``
输入:
- **x** (Tensor[bool]) - bool类型的输入Tensor。
- **axis** (Union[int, tuple(int), list(int), Tensor],可选) - 要归约计算的维度。默认值: ``()`` ,在所有维度上归约。只允许常量值。取值必须在[-rank(`x`), rank(`x`))范围内。
输出:
bool类型的Tensor。
- 如果 `axis```()`` ,且 `keep_dims```False``
则输出一个零维Tensor表示输入Tensor中所有元素的逻辑或运算结果。
- 如果 `axis` 为int值为2并且 `keep_dims```False``
则输出Tensor的shape为 :math:`(x_1, x_3, ..., x_R)`
- 如果 `axis` 为tuple(int),值为(2, 3),并且 `keep_dims```False``
则输出Tensor的shape为 :math:`(x_1, x_4, ..., x_R)`
- 如果 `axis` 为一维Tensor值为[2, 3],并且 `keep_dims```False``
则输出Tensor的shape为 :math:`(x_1, x_4, ..., x_R)`
异常:
- **TypeError** - `keep_dims` 不是bool类型。
- **TypeError** - `x` 不是Tensor。
- **TypeError** - `axis` 不是以下数据类型之一int、Tuple、List或Tensor。