(self, optimizer, opt)
| 118 | print('Total number of parameters: %d' % num_params) |
| 119 | |
| 120 | def _get_scheduler(self, optimizer, opt): |
| 121 | if opt.lr_policy == 'lambda': |
| 122 | def lambda_rule(epoch): |
| 123 | lr_l = 1.0 - max(0, epoch + 1 + opt.epoch_count - opt.niter) / float(opt.niter_decay + 1) |
| 124 | return lr_l |
| 125 | scheduler = lr_scheduler.LambdaLR(optimizer, lr_lambda=lambda_rule) |
| 126 | elif opt.lr_policy == 'step': |
| 127 | scheduler = lr_scheduler.StepLR(optimizer, step_size=opt.lr_decay_iters, gamma=0.1) |
| 128 | elif opt.lr_policy == 'plateau': |
| 129 | scheduler = lr_scheduler.ReduceLROnPlateau(optimizer, mode='min', factor=0.2, threshold=0.01, patience=5) |
| 130 | else: |
| 131 | return NotImplementedError('learning rate policy [%s] is not implemented', opt.lr_policy) |
| 132 | return scheduler |
nothing calls this directly
no outgoing calls
no test coverage detected