fn
absolute
→Tensorabsolute(x: Tensor)Element-wise absolute value.
Verbose alias of lucid.abs, exposed for parity with reference
frameworks that publish both abs and absolute spellings of the
same operation.
Parameters
xTensorInput tensor. Any numeric dtype.
Returns
TensorTensor of the same shape and dtype as x containing
element-wise.
Notes
Mathematical definition:
The gradient is ; the sub-gradient at
is conventionally taken to be 0.
Examples
>>> import lucid
>>> x = lucid.tensor([-1.5, 0.0, 2.0])
>>> lucid.absolute(x)
Tensor([1.5, 0., 2.])