reminisce commented on issue #16716: [Numpy] Fix collect_params().zero_grad() 
in gluon numpy interface
URL: https://github.com/apache/incubator-mxnet/pull/16716#issuecomment-551388401
 
 
   To avoid too frequent cuda stream synchronization for the arrays to be 
zeroed without introducing an operator, I think we can put the assignment loop 
into the bulk scope so that there should be only one stream synchronization in 
the end. 
   ```python
   with mx.engine.bulk(len(arrays)):
       for arr in arrays:
           arr[:] = 0
   ```

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to