From 1fe16f71ddef01a9bdc57bb1841c9f179df2c69e Mon Sep 17 00:00:00 2001 From: James Betker Date: Tue, 25 Aug 2020 16:37:45 -0600 Subject: [PATCH] Fix bug reporting spsr gan weight --- codes/models/SRGAN_model.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/codes/models/SRGAN_model.py b/codes/models/SRGAN_model.py index 1738e902..6145bde7 100644 --- a/codes/models/SRGAN_model.py +++ b/codes/models/SRGAN_model.py @@ -840,7 +840,7 @@ class SRGANModel(BaseModel): self.add_log_entry('l_d_fake', l_d_fake_log.detach().item()) self.add_log_entry('D_fake', torch.mean(pred_d_fake.detach())) self.add_log_entry('D_diff', torch.mean(pred_d_fake.detach()) - torch.mean(pred_d_real.detach())) - if self.spsr_enabled: + if self.spsr_enabled and self.l_gan_grad_w > 0: self.add_log_entry('l_d_real_grad', l_d_real_grad.detach().item()) self.add_log_entry('l_d_fake_grad', l_d_fake_grad.detach().item()) self.add_log_entry('D_fake_grad', torch.mean(pred_d_fake_grad.detach()))