core/optim/grad_utils library
Gradient regularization utilities.
Functions
-
clipGradNorm(
List< Tensor> parameters, double maxNorm) → double -
Clip the global L2 norm of the gradients across
parametersto at mostmaxNorm, in place. Returns the pre-clip total norm — useful for logging.