Function dfdx::tensor_ops::clamp
source · [−]Expand description
Clamp all elements between the provided min and max values.
Example:
let t = Tensor1D::new([-1.0, -0.5, 0.0, 0.5, 1.0]);
let r = t.clamp(-0.5, 0.5);
assert_eq!(r.data(), &[-0.5, -0.5, 0.0, 0.5, 0.5]);