(self, current_iter)
| 91 | self.lq_path = data.get('lq_path', None) |
| 92 | |
| 93 | def optimize_parameters(self, current_iter): |
| 94 | self.optimizer_g.zero_grad() |
| 95 | self.output = self.net_g(self.lq) |
| 96 | |
| 97 | l_total = 0 |
| 98 | loss_dict = OrderedDict() |
| 99 | |
| 100 | if self.cri_pix: |
| 101 | l_pix = self.cri_pix(self.output, self.gt) |
| 102 | l_total += l_pix |
| 103 | loss_dict['l_pix'] = l_pix |
| 104 | |
| 105 | if self.cri_perceptual: |
| 106 | l_percep = self.cri_perceptual(self.output, self.gt) |
| 107 | if l_percep is not None: |
| 108 | l_total += l_percep |
| 109 | loss_dict['l_percep'] = l_percep |
| 110 | |
| 111 | l_total.backward() |
| 112 | self.optimizer_g.step() |
| 113 | |
| 114 | self.log_dict = self.reduce_loss_dict(loss_dict) |
| 115 | |
| 116 | if self.ema_decay > 0: |
| 117 | self.model_ema(decay=self.ema_decay) |
| 118 | |
| 119 | def test(self): |
| 120 | if hasattr(self, 'net_g_ema'): |
nothing calls this directly
no test coverage detected