pytorch/torch/optim
Gregory Chanan fc82ec298b Update CosineAnnealingWarmRestarts to follow PyTorch 1.1+ Step Order. (#23833)
Summary:
Fixes: https://github.com/pytorch/pytorch/issues/23480.

I only verified that the schedule reaches the restart at the expected step as specified in the issue, it would be good to have someone else verify correctness here.

Script:
```
scheduler = torch.optim.lr_scheduler.CosineAnnealingWarmRestarts(torch.optim.SGD([torch.randn(1, requires_grad=True)], lr=0.5), T_0=1, T_mult=2)
for i in range(9):
    print(i)
    print(scheduler.get_lr())
    scheduler.step()
```
Output:
```
0
[0.5]
1
[0.5]
2
[0.25]
3
[0.5]
4
[0.42677669529663687]
5
[0.25]
6
[0.07322330470336313]
7
[0.5]
8
[0.4809698831278217]
```
Pull Request resolved: https://github.com/pytorch/pytorch/pull/23833

Differential Revision: D16657251

Pulled By: gchanan

fbshipit-source-id: 713973cb7cbfc85dc333641cbe9feaf917718eb9
2019-08-07 07:15:50 -07:00
..
__init__.py Implement AdamW optimizer (#21250) 2019-07-02 09:09:10 -07:00
__init__.pyi More type stubs (#18511) 2019-04-01 16:03:58 -07:00
adadelta.py Added parameter range checks for all optimizers (#6000) 2018-03-28 11:22:23 +02:00
adagrad.py Revert D14577575: [pytorch][PR] Fix lack of state init for adagrad and add share_memory flag 2019-04-26 15:43:04 -07:00
adam.py Adam/AdamW implementation minor fix (#22628) 2019-08-01 11:42:04 -07:00
adam.pyi More type stubs (#18511) 2019-04-01 16:03:58 -07:00
adamax.py Added parameter range checks for all optimizers (#6000) 2018-03-28 11:22:23 +02:00
adamw.py Adam/AdamW implementation minor fix (#22628) 2019-08-01 11:42:04 -07:00
asgd.py Added parameter range checks for all optimizers (#6000) 2018-03-28 11:22:23 +02:00
lbfgs.py Use lower case for strong wolfe option. (#22092) 2019-06-26 08:20:25 -07:00
lr_scheduler.py Update CosineAnnealingWarmRestarts to follow PyTorch 1.1+ Step Order. (#23833) 2019-08-07 07:15:50 -07:00
lr_scheduler.pyi Renamed CosineAnnealingLr to CosineAnnealingLR (#23242) 2019-07-23 14:54:15 -07:00
optimizer.py Lightweight at-most-once logging for API usage (#20745) 2019-05-23 23:17:59 -07:00
optimizer.pyi Fix optimizer type hint (#20648) 2019-05-22 11:27:40 -07:00
rmsprop.py Added parameter range checks for all optimizers (#6000) 2018-03-28 11:22:23 +02:00
rprop.py Turn on F401: Unused import warning. (#18598) 2019-03-30 09:01:17 -07:00
sgd.py SGD: remove unneeded multiply-add initialization operations (#18114) 2019-03-19 10:34:17 -07:00
sgd.pyi More type stubs (#18511) 2019-04-01 16:03:58 -07:00
sparse_adam.py fix lint after new flake8 release added new style constraints (#13047) 2018-10-24 09:03:38 -07:00