Skip to content

Commit 3e4b02f

Browse files
committed
update: g0_norm
1 parent f8aa431 commit 3e4b02f

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

pytorch_optimizer/optimizer/dadapt.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -500,12 +500,10 @@ def step(self, closure: CLOSURE = None) -> LOSS:
500500
return loss
501501

502502
group = self.param_groups[0]
503+
503504
if group['k'] == 0:
504505
group['g0_norm'] = g_sq.sqrt().item()
505-
506506
g0_norm = group['g0_norm']
507-
if g0_norm == 0:
508-
g0_norm = 1.0
509507

510508
d, lr = group['d'], group['lr']
511509
d_lr = float(d * lr) / g0_norm

0 commit comments

Comments
 (0)