From f8797c0e94ee0864fc047d3f9b4a951d8c723d0e Mon Sep 17 00:00:00 2001 From: Suvojit Manna <10397574+suvojit-0x55aa@users.noreply.github.com> Date: Fri, 17 Apr 2020 12:27:52 +0530 Subject: [PATCH] Update diffGrad.py --- diffGrad.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/diffGrad.py b/diffGrad.py index 5a5bfa7..4408b4a 100644 --- a/diffGrad.py +++ b/diffGrad.py @@ -97,7 +97,7 @@ def step(self, closure=None): # compute diffgrad coefficient (dfc) diff = abs(previous_grad - grad) dfc = 1. / (1. + torch.exp(-diff)) - state['previous_grad'] = grad %used in paper but has the bug that previous grad is overwritten with grad and diff becomes always zero. Fixed in the next line. + state['previous_grad'] = grad # used in paper but has the bug that previous grad is overwritten with grad and diff becomes always zero. Fixed in the next line. # update momentum with dfc exp_avg1 = exp_avg * dfc