fn
negative
→Tensornegative(x: Tensor)Element-wise negation.
Verbose alias of lucid.neg. Equivalent to the unary - operator
on a tensor.
Parameters
xTensorInput tensor. Any numeric dtype.
Returns
TensorTensor of the same shape and dtype as x whose entries are
.
Notes
Mathematical definition:
The gradient with respect to x is everywhere.
Examples
>>> import lucid
>>> x = lucid.tensor([1.0, -2.0, 3.5])
>>> lucid.negative(x)
Tensor([-1., 2., -3.5])