Created
June 22, 2020 06:31
-
-
Save maskaravivek/bbb1fcf51f2ba464585f5ac2d0f5793c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
LR_SCHEDULE = [ | |
# (epoch to start, learning rate) tuples | |
(0, 0.01), | |
(75, 0.001), | |
(105, 0.0001), | |
] | |
def lr_schedule(epoch, lr): | |
"""Helper function to retrieve the scheduled learning rate based on epoch.""" | |
if epoch < LR_SCHEDULE[0][0] or epoch > LR_SCHEDULE[-1][0]: | |
return lr | |
for i in range(len(LR_SCHEDULE)): | |
if epoch == LR_SCHEDULE[i][0]: | |
return LR_SCHEDULE[i][1] | |
return lr |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment