MCPcopy Create free account
hub / github.com/pytorch/examples / test

Function test

super_resolution/main.py:63–73  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

61
62
63def test():
64 avg_psnr = 0
65 with torch.no_grad():
66 for batch in testing_data_loader:
67 input, target = batch[0].to(device), batch[1].to(device)
68
69 prediction = model(input)
70 mse = criterion(prediction, target)
71 psnr = 10 * log10(1 / mse.item())
72 avg_psnr += psnr
73 print("===> Avg. PSNR: {:.4f} dB".format(avg_psnr / len(testing_data_loader)))
74
75
76def checkpoint(epoch):

Callers 1

main.pyFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected