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

Method get_lr

schedulers/linearlr.py:63–76  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

61 super(LinearLR, self).__init__(optimizer, last_epoch, verbose)
62
63 def get_lr(self):
64 if not self._get_lr_called_within_step:
65 warnings.warn("To get the last learning rate computed by the scheduler, "
66 "please use `get_last_lr()`.", UserWarning)
67
68 if self.last_epoch == 0:
69 return [group['lr'] * self.start_factor for group in self.optimizer.param_groups]
70
71 if (self.last_epoch > self.total_iters):
72 return [group['lr'] for group in self.optimizer.param_groups]
73
74 return [group['lr'] * (1. + (self.end_factor - self.start_factor) /
75 (self.total_iters * self.start_factor + (self.last_epoch - 1) * (self.end_factor - self.start_factor)))
76 for group in self.optimizer.param_groups]
77
78 def _get_closed_form_lr(self):
79 return [base_lr * (self.start_factor +

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected