reminisce commented on a change in pull request #16716: [Numpy][WIP] Fix 
collect_params().zero_grad() in gluon numpy interface
URL: https://github.com/apache/incubator-mxnet/pull/16716#discussion_r342187118
 
 

 ##########
 File path: python/mxnet/gluon/parameter.py
 ##########
 @@ -904,7 +904,11 @@ def zero_grad(self):
             return
 
         for arr in arrays.values():
-            mx.nd.reset_arrays(*arr, num_arrays=len(arr))
+            if is_np_array():
+                for ele in arr:
+                    ele[:] = 0
+            else:
+                mx.nd.reset_arrays(*arr, num_arrays=len(arr))
 
 Review comment:
   Sounds good to me.

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


With regards,
Apache Git Services

Reply via email to