fn

isfinite

Tensor
isfinite(input: Tensor)
source

Element-wise IEEE 754 finiteness check.

Returns a boolean tensor that is True where the entry is neither infinite nor NaN.

Parameters

inputTensor
Input tensor.

Returns

Tensor

Element-wise result with the same shape as input.

Notes

Mathematical definition:

outi=¬(isinf(xi)isnan(xi))\text{out}_i = \neg(\mathrm{isinf}(x_i) \lor \mathrm{isnan}(x_i))

Output dtype is bool. Not differentiable.

Examples

>>> import lucid
>>> x = lucid.tensor([1.0, 2.0, 3.0])
>>> lucid.isfinite(x)
Tensor([...])