sparkydogX / sparkydogx_blog_comment

Comments for https://sparkydogx.github.io
1 stars 0 forks source link

在pytorch中设置learning rate的衰减 | SparkydogX Blog #73

Open sparkydogX opened 5 years ago

sparkydogX commented 5 years ago

https://sparkydogx.github.io/2018/08/10/lr-decay-pytorch/

很多时候我们要对学习率(learning rate)进行衰减,下面的代码示范了如何每30个epoch按10%的速率衰减: 12345def adjust_learning_rate(optimizer, epoch): """Sets the learning rate to the initial LR decayed by 10 every 30 epochs""" lr = ar