mindspore.Tensor.all
- Tensor.all(axis=(), keep_dims=False)[source]
Check all tensor elements along a given axis evaluate to True.
- Parameters
axis (Union[None, int, tuple(int)]) – Dimensions of reduction. When the axis is None or empty tuple, reduce all dimensions. When the axis is int or tuple(int), if the dimension of Tensor is dim, the value range is [-dim, dim). Default: ().
keep_dims (bool) – Whether to keep the reduced dimensions. Default: False.
- Returns
Tensor, if all tensor elements along the given axis evaluate to True, its value is True, otherwise its value is False. If the axis is None or empty tuple, reduce all dimensions.
- Supported Platforms:
Ascend
GPU
CPU
See also
mindspore.Tensor.any()
: Check any tensor element along a given axis evaluate to True.Examples
>>> from mindspore import Tensor >>> a = Tensor([True, True, False]) >>> output = a.all() >>> print(output) False