1. 程式人生 > >pytorch餘弦退火,learning rate 衰減

pytorch餘弦退火,learning rate 衰減

lr_scheduler = optim.lr_scheduler.CosineAnnealingLR(optimizer, T_max=5,eta_min=4e-08)

lr_scheduler.step()

Example:

scheduler = optim.lr_scheduler.CosineAnnealingLR(optimizer, T_max=5,eta_min=4e-08)
for epoch in range(100):
scheduler.step()
train(…)
validate(…)