(self)
| 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 + |
nothing calls this directly
no outgoing calls
no test coverage detected