MCPcopy Create free account
hub / github.com/SLDGroup/EMCAD / PolyLR

Class PolyLR

utils/misc.py:100–112  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

98
99
100class PolyLR(object):
101 def __init__(self, optimizer, curr_iter, max_iter, lr_decay):
102 self.max_iter = float(max_iter)
103 self.init_lr_groups = []
104 for p in optimizer.param_groups:
105 self.init_lr_groups.append(p['lr'])
106 self.param_groups = optimizer.param_groups
107 self.curr_iter = curr_iter
108 self.lr_decay = lr_decay
109
110 def step(self):
111 for idx, p in enumerate(self.param_groups):
112 p['lr'] = self.init_lr_groups[idx] * (1 - self.curr_iter / self.max_iter) ** self.lr_decay
113
114
115# just a try, not recommend to use

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected