Skip to main content

clip_gradient

Function clip_gradient 

Source
pub fn clip_gradient(grad: &mut [f64], max_norm: f64)
Expand description

Clips the L2 norm of grad to max_norm (in-place).

Used in deep learning / physics-ML to stabilise training.