Inconsistant values of lr_scheduler.get_lr and lr in optimizer.param_groups #20138
Labels
module: optimizer
Related to torch.optim
triaged
This issue has been looked at a team member, and triaged and prioritized into an appropriate module
🐛 Bug
After upgrading to 1.1.0, the value returned by
lr_scheduler.get_lr
is confusing comparing to the lr value insideoptimizer.param_groups
.To Reproduce
Here I follow the new convention putting the
lr_scheduler.step()
at the end of each iteration, see the new documents and #7889 (which is probably the root of this issue).Code:
Output:
We got inconsistant values. The two values are the same in the first line, but different in following lines by lr decay factor
gamma = 0.9
.Expected behavior
At least we should have consistant values of the two, right?
In the old version 1.0.1, if we follow the previous convention putting the
lr_scheduler.step()
at the beginning of each iteration, the output values are reasonable and consistant:Code:
Output:
Environment
I'll skip this part since it can be easily reproduced from a fresh 1.1.0 installation.
The text was updated successfully, but these errors were encountered: