Skip to content

Commit d428d08

Browse files
fantesmergify[bot]
authored andcommitted
fix(torch/ranger): allow not to use lookahead
1 parent 82e2695 commit d428d08

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/backends/torch/optim/ranger.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ namespace dd
221221
p.add_(exp_avg, -step_size * options.lr());
222222
}
223223
}
224-
if (state.step() % options.lsteps() == 0)
224+
if (state.step() % options.lsteps() == 0 && options.lookahead())
225225
{
226226
auto slow_p = state.slow_buffer();
227227
slow_p.add_(p.data() - slow_p, options.lalpha());

0 commit comments

Comments
 (0)