Function dfdx::tensor_ops::abs
source · [−]Expand description
Absolute value (abs). |t|
The derivative is -1.0 for t < 0, 0 for t == 0, and 1.0 for t > 0.
Examples:
let t = Tensor1D::new([-1.0, 0.0, 1.0, 2.0]);
// use function version
let r = abs(t.clone());
// or the tensor method!
let r2 = t.abs();