Skip to content

Commit

Permalink
Apply no_grad in the inference phase
Browse files Browse the repository at this point in the history
  • Loading branch information
nmhkahn committed Nov 6, 2018
1 parent f5a8319 commit 5758408
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion carnpp/solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ def evaluate(self, test_data, scale=2):
for step, inputs in enumerate(test_loader):
HR = inputs[0].to(self.device)
LR = inputs[1].to(self.device)
SR = self.net(LR, scale).detach()
with torch.no_grad():
SR = self.net(LR, scale).detach()

HR = HR.cpu().clamp(0, 1).squeeze(0).permute(1, 2, 0).numpy()
SR = SR.cpu().clamp(0, 1).squeeze(0).permute(1, 2, 0).numpy()
Expand Down

0 comments on commit 5758408

Please sign in to comment.