MCPcopy Create free account
hub / github.com/Meshcapade/difflocks / get_lr

Method get_lr

schedulers/multisteplr.py:50–58  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

48 super(MultiStepLR, self).__init__(optimizer, last_epoch, verbose)
49
50 def get_lr(self):
51 if not self._get_lr_called_within_step:
52 warnings.warn("To get the last learning rate computed by the scheduler, "
53 "please use `get_last_lr()`.", UserWarning)
54
55 if self.last_epoch not in self.milestones:
56 return [group['lr'] for group in self.optimizer.param_groups]
57 return [group['lr'] * self.gamma ** self.milestones[self.last_epoch]
58 for group in self.optimizer.param_groups]
59
60 def _get_closed_form_lr(self):
61 milestones = list(sorted(self.milestones.elements()))

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected