fn

isposinf

Tensor
isposinf(x: Tensor)
source

Element-wise test for positive infinity.

Identifies entries that are exactly ++\infty in the IEEE 754 floating-point sense. Finite values and -\infty both report False.

Parameters

xTensor
Floating-point input tensor.

Returns

Tensor

Boolean tensor of the same shape as x.

Notes

Defined as the conjunction of "is infinite" and "is positive":

outi=isinf(xi)(xi>0).\text{out}_i = \operatorname{isinf}(x_i) \wedge (x_i > 0).

NaN inputs report False.

Examples

>>> import lucid
>>> import math
>>> x = lucid.tensor([-math.inf, -1.0, 0.0, math.inf])
>>> lucid.isposinf(x)
Tensor([False, False, False,  True])