You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2018/08/21 17:20:09 UTC

[GitHub] szha commented on a change in pull request #12042: Make check_isfinite, check_scale optional in clip_global_norm

szha commented on a change in pull request #12042: Make check_isfinite, check_scale optional in clip_global_norm
URL: https://github.com/apache/incubator-mxnet/pull/12042#discussion_r211689072
 
 

 ##########
 File path: python/mxnet/gluon/utils.py
 ##########
 @@ -115,8 +115,21 @@ def split_and_load(data, ctx_list, batch_axis=0, even_split=True):
     return [i.as_in_context(ctx) for i, ctx in zip(slices, ctx_list)]
 
 
-def clip_global_norm(arrays, max_norm):
+def clip_global_norm(arrays, max_norm, check_isfinite=True, check_scale=True):
     """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.
+    check_scale : bool, default True
+         If True, skip array rescaling if max_norm / total_norm >= 1. This
+         requires a blocking call. If False, rescale arrays with min(1,
 
 Review comment:
   rescale is not blocking

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services