szha commented on a change in pull request #13683: fix bug in nag optimizer
URL: https://github.com/apache/incubator-mxnet/pull/13683#discussion_r247753992
 
 

 ##########
 File path: tests/python/unittest/test_optimizer.py
 ##########
 @@ -384,11 +384,9 @@ def update(self, index, weight, grad, state):
                 weight[:] += -lr * (grad + wd * weight)
             else:
               mom = state
-              mom[:] *= self.momentum
-              grad += wd * weight
-              mom[:] += grad
+              mom[:] = self.momentum * mom[:] + grad + wd * weight
 
 Review comment:
   try doing all these with in-place operators.

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to