Implementing kernel
C++ engine symbols that back this Python API.Element-wise sign function.
Returns -1 for negative entries, 0 for zero, and +1 for positive entries.
Parameters
inputTensorInput tensor.
Returns
TensorElement-wise result with the same shape as input.
Notes
Mathematical definition:
Gradient is zero almost everywhere (treated as zero in autograd).
Examples
>>> import lucid
>>> x = lucid.tensor([1.0, 2.0, 3.0])
>>> lucid.sign(x)
Tensor([...])