Skip to content

Commit

Permalink
Create lr_policy.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Willy0919 authored Jul 21, 2019
1 parent 8e2f78e commit 5cc0ce3
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/lib/opt/lr_policy.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Written by Willy

def update_lr(optimizer, epoch, steps, decay_rate):
if epoch in steps:
for param_group in optimizer.param_groups:
print('before_lr',param_group['lr'])
param_group['lr'] *= decay_rate
print('after_lr',param_group['lr'])
return optimizer

0 comments on commit 5cc0ce3

Please sign in to comment.