mindspore.mint.isfinite

View Source On AtomGit
mindspore.mint.isfinite(input)[source]

Return whether each element in the input is a finite number. The definition of finite number: the element which is not NaN , -INF , or INF .

\[\begin{split}out_i = \begin{cases} & \text{ if } input_{i} = \text{Finite},\ \ True \\ & \text{ if } input_{i} \ne \text{Finite},\ \ False \end{cases}\end{split}\]
Parameters

input (Tensor) – The input tensor.

Returns

Boolean tensor

Supported Platforms:

Ascend

Examples

>>> import mindspore
>>> x = mindspore.mint.log(mindspore.tensor([-1,0]))
>>> mindspore.mint.isfinite(x)
Tensor(shape=[2], dtype=Bool, value= [False, False])
>>> x = mindspore.tensor(2.1, mindspore.float64)
>>> mindspore.mint.isfinite(x)
Tensor(shape=[], dtype=Bool, value= True)