fn

logical_not

Tensor
logical_not(input: Tensor)
source

Element-wise logical NOT.

Returns a boolean tensor that is True where input is falsy (numerically zero or boolean False) and False otherwise.

Parameters

inputTensor
Input tensor; values are interpreted as booleans (zero → False, non-zero → True).

Returns

Tensor

Boolean tensor with the same shape as input.

Notes

Mathematical definition:

outi=¬xˉi\text{out}_i = \neg \bar{x}_i

Not differentiable; gradients are dropped.

Examples

>>> import lucid
>>> x = lucid.tensor([True, False, True])
>>> lucid.logical_not(x)
Tensor([False, True, False])