mindspore.Tensor.isfinite

Tensor.isfinite()[source]

Determines which elements are finite for each position.

Returns

Tensor, has the same shape of input, and the dtype is bool.

Raises

TypeError – If self Tensor is not Tensor.

Supported Platforms:

Ascend GPU CPU

Examples

>>> from mindspore import Tensor
>>> a = Tensor(np.array([np.log(-1), 1, np.log(0)]), mindspore.float32)
>>> output = a.isfinite()
>>> print(output)
[False True False]