Dear @ptrblck
I ran this code on colab and the output is not consistent. link to colab
import torch
print(“pytorch version”,torch. version )
import torch.nn as nn
model = nn.Linear(1, 1) # ‘Net’ is a simple MLP
optimizer = torch.optim.SGD(model.parameters(), lr=0.1)
schedular = torch.optim.lr_scheduler.MultiStepLR(optimizer, milestones = [4,7], gamma=0.1)
print(‘Initial LR : {0:.8f}’.format(schedular.get_lr()[0]))
for e in range(8):
schedular.step()
print(‘Epoch {0}, LR: {1:.8f}, opt LR {2:.8f}’.format(e, schedular.get_lr()[0],
optimizer.param_groups[0][‘lr’]))
pytorch version 1.4.0
Initial LR : 0.10000000
Epoch 0, LR: 0.10000000, opt LR 0.10000000
Epoch 1, LR: 0.10000000, opt LR 0.10000000
Epoch 2, LR: 0.10000000, opt LR 0.10000000
Epoch 3, LR: 0.00100000, opt LR 0.01000000
Epoch 4, LR: 0.01000000, opt LR 0.01000000
Epoch 5, LR: 0.01000000, opt LR 0.01000000
Epoch 6, LR: 0.00010000, opt LR 0.00100000
Epoch 7, LR: 0.00100000, opt LR 0.00100000