clip_grad_norm_(parameters, max_norm, norm_type=2.0, error_if_nonfinite=False)¶
Clips gradient norm of an iterable of parameters.
The norm is computed over all gradients together, as if they were concatenated into a single vector. Gradients are modified in-place.
error_if_nonfinite (bool) – if True, an error is thrown if the total norm of the gradients from
-inf. Default: False (will switch to True in the future)
Total norm of the parameters (viewed as a single vector).