mindspore.mint.any

View Source On Gitee
mindspore.mint.any(input) Tensor[source]

Check if True is present in input .

Parameters

input (Tensor) – The input tensor.

Returns

Tensor

Supported Platforms:

Ascend

Examples

>>> import mindspore
>>> input = mindspore.tensor([[True, False], [True, True]])
>>> mindspore.mint.any(input)
Tensor(shape=[], dtype=Bool, value= True)
mindspore.mint.any(input, dim, keepdim=False) Tensor[source]

Check if True is present in the specified dimension of input .

Parameters
  • input (Tensor) – The input tensor.

  • dim (int) – The dimensions to reduce.

  • keepdim (bool, optional) – Whether the output tensor has dim retained or not. Default False .

Returns

Tensor

Supported Platforms:

Ascend

Examples

>>> import mindspore
>>> input = mindspore.tensor([[True, False], [True, True]])
>>> mindspore.mint.any(input, dim=1)
Tensor(shape=[2], dtype=Bool, value= [ True,  True])