Function autograd::ops::clip
[−]
[src]
pub fn clip(x: &Tensor, min: f32, max: f32) -> Tensor
Limits all elements so as to be within [min, max]
extern crate ndarray; extern crate autograd as ag; let mut ctx = ag::Context::new(); let ref x = ag::constant(ndarray::arr1(&[2., 4., 6.]), &mut ctx); let ref y = ag::clip(x, 3., 5.); assert_eq!(y.eval(&mut ctx), ndarray::arr1(&[3., 4., 5.]).into_dyn());