fn

isneginf

Tensor
isneginf(x: Tensor)
source

Element-wise test for negative 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 negative":

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

NaN inputs report False because NaN compares false against any real value, including in isinf.

Examples

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