anirudhacharya commented on a change in pull request #13683: fix bug in nag
optimizer
URL: https://github.com/apache/incubator-mxnet/pull/13683#discussion_r243035067
##########
File path: python/mxnet/optimizer/optimizer.py
##########
@@ -974,8 +974,7 @@ def update(self, index, weight, grad, state):
if state is not None:
mom = state
mom[:] *= self.momentum
- grad += wd * weight
- mom[:] += grad
+ mom[:] += grad + wd * weight
grad[:] += self.momentum * mom
weight[:] += -lr * grad
Review comment:
can you make this `weight[:] -= lr * grad` it is more clear this way
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services