pub fn clip_grad_value<B>(
grads: &GradStore<B>,
params: &[Tensor<B>],
max_value: f64,
) -> Result<GradStore<B>, Error>where
B: Backend,Expand description
Clamp each gradient element to [-max_value, max_value].
This is a simpler but less commonly used strategy than norm clipping.
Returns clipped_grads.