Skip to content
fn

isinf

→Tensor
isinf(input: Tensor)

Implementing kernel

C++ engine symbols that back this Python API.

Element-wise IEEE 754 infinity check.

Returns a boolean tensor that is True where the entry equals +∞+\infty or −∞-\infty.

Parameters

inputTensor
Input tensor.

Returns

Tensor

Element-wise result with the same shape as input.

Notes

Mathematical definition:

outi={Truexi∈{+∞,−∞}Falseotherwise\text{out}_i = \begin{cases} \text{True} & x_i \in \{+\infty, -\infty\} \\ \text{False} & \text{otherwise} \end{cases}

Output dtype is bool. Not differentiable.

Examples

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