mxnet.gluon.utils.clip_global_norm¶
-
mxnet.gluon.utils.
clip_global_norm
(arrays, max_norm, check_isfinite=True)[source]¶ Rescales NDArrays so that the sum of their 2-norm is smaller than max_norm.
- Parameters
arrays (list of NDArray) –
max_norm (float) –
check_isfinite (bool, default True) – If True, check that the total_norm is finite (not nan or inf). This requires a blocking .asscalar() call.
- Returns
Total norm. Return type is NDArray of shape (1,) if check_isfinite is False. Otherwise a float is returned.
- Return type
NDArray or float