eric-haibin-lin commented on a change in pull request #17010: [API] unified API 
for custom kvstores
URL: https://github.com/apache/incubator-mxnet/pull/17010#discussion_r357866085
 
 

 ##########
 File path: python/mxnet/gluon/trainer.py
 ##########
 @@ -354,14 +366,30 @@ def allreduce_grads(self):
         self._allreduce_grads()
 
     def _allreduce_grads(self):
-        if self._kvstore:
-            for i, param in enumerate(self._params):
-                if param.grad_req != 'null':
+        # nothing to reduce
+        if not self._kvstore:
+            return
+        for i, param in enumerate(self._params):
+            if param.grad_req != 'null':
 
-                    self._kvstore.push(i, param.list_grad(), priority=-i)
-                    if not self._update_on_kvstore:
-                        self._kvstore.pull(i, param.list_grad(), priority=-i,
+                grad_list = param.list_grad()
+                # sparse gradients, call push and pull separately
+                if grad_list[0].stype != 'default':
 
 Review comment:
   where is the double negative condition? There is only one negative 
condition, right?

----------------------------------------------------------------
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