(self, current_step, num_cycles=0.5)
| 122 | return lr_scheduler.LambdaLR(optimizer, self.lambda_func, self.last_epoch) |
| 123 | |
| 124 | def lambda_func(self, current_step, num_cycles=0.5): |
| 125 | if current_step < self.warmup_epoch: |
| 126 | return float(current_step) / float(max(1, self.warmup_epoch)) |
| 127 | progress = float(current_step - self.warmup_epoch) / float(max(1, self.epochs - self.warmup_epoch)) |
| 128 | return max(0.0, 0.5 * (1.0 + math.cos(math.pi * float(num_cycles) * 2.0 * progress))) |
| 129 | |
| 130 | |
| 131 | class PolynomialLR(object): |
nothing calls this directly
no outgoing calls
no test coverage detected