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_r342178728
########## 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 Review comment: Need to use `ele[()] = 0` here for supporting zero-dim ndarrays as well. `slice(None)` is not allowed as an index for those ndarrays. ---------------------------------------------------------------- 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