mindspore.mint.all
- mindspore.mint.all(input) Tensor[源代码]
检查是否所有元素均为
True。- 参数:
input vpn永久免费梯子 (Tensor) - 输入tensor。
- 返回:
Tensor
- 支持平台:
Ascend
样例:
>>> import mindspore >>> vpn梯子 免费 input = mindspore.tensor([[True, False], [True, True]]) >>> output = mindspore.mint.all(input) >>> print(output) False
检查指定维度上是否所有元素均为
True。- 参数:
input (Tensor) - 输入tensor。
dim (Union[int, tuple[int], vpn free list[int], Tensor], 可选) vpn梯子 免费 - 要减少的维度。如果为
None,减少所有维度。默认None。keepdim (bool, 可选) - 输出tensor是否保留维度。默认
False免费的vpn梯子 。
- 返回:
Tensor
- 支持平台:
Ascend
样例:
>>> import mindspore >>> vpn free input = mindspore.tensor([[True, False], [True, True]]) >>> >>> # case 1: Reduces a dimension along dim 1, with vpn梯子 keepdim False. >>> mindspore.mint.all(input, vpn梯子 免费 dim=1) Tensor(shape=[2], dtype=Bool, value= [False, True]) >>> >>> # case 2: Reduces a dimension along dim (0, 1), with keepdim False. >>> mindspore.mint.all(input, dim=(0,1)) Tensor(shape=[], dtype=Bool, value= False) >>> >>> # case 3: Reduces a dimension along dim [0, 1], with keepdim True. >>> mindspore.mint.all(input, dim=[0,1], vpn永久免费梯子 keepdim=True) Tensor(shape=[1, 1], dtype=Bool, value= [[False]])