From 1b5fa9f7aa37a7731fc8831ab08f1e9460315a7f Mon Sep 17 00:00:00 2001 From: Morvan Zhou Date: Tue, 27 Jun 2017 17:00:01 +1000 Subject: [PATCH] update --- tutorial-contents/502_GPU.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tutorial-contents/502_GPU.py b/tutorial-contents/502_GPU.py index ba1c0dc..ba2d4e6 100644 --- a/tutorial-contents/502_GPU.py +++ b/tutorial-contents/502_GPU.py @@ -71,7 +71,7 @@ for epoch in range(EPOCH): # !!!!!!!! Change in here !!!!!!!!! # pred_y = torch.max(test_output, 1)[1].cuda().data.squeeze() # move the computation in GPU - accuracy = sum(pred_y == test_y) / test_y.size(0) + accuracy = torch.sum(pred_y == test_y) / test_y.size(0) print('Epoch: ', epoch, '| train loss: %.4f' % loss.data[0], '| test accuracy: %.2f' % accuracy)