fn
signbit
→Tensorsignbit(x: Tensor)Element-wise sign-bit predicate.
Returns a boolean tensor that is True wherever x is strictly
negative. The current implementation uses the strict inequality
x < 0, so -0.0 reports False (i.e. the value is treated
as zero rather than tested via IEEE 754 sign-bit inspection).
Parameters
xTensorInput tensor. Any numeric dtype.
Returns
TensorBoolean tensor of the same shape as x.
Notes
Mathematical definition:
Non-differentiable: the gradient is zero almost everywhere and the output dtype is boolean.
Examples
>>> import lucid
>>> x = lucid.tensor([-1.0, 0.0, 1.0])
>>> lucid.signbit(x)
Tensor([ True, False, False])