From b2922fd3f3c8d49be3cae275375a88e844278d2a Mon Sep 17 00:00:00 2001 From: Morvan Zhou Date: Wed, 24 May 2017 13:30:46 +1000 Subject: [PATCH] update --- tutorial-contents/502_GPU.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tutorial-contents/502_GPU.py b/tutorial-contents/502_GPU.py index 9403ab3..ba1c0dc 100644 --- a/tutorial-contents/502_GPU.py +++ b/tutorial-contents/502_GPU.py @@ -69,7 +69,7 @@ for epoch in range(EPOCH): test_output = cnn(test_x) # !!!!!!!! Change in here !!!!!!!!! # - pred_y = torch.max(test_output, 1)[1].cuda().data.squeeze() # Move to CPU + 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) print('Epoch: ', epoch, '| train loss: %.4f' % loss.data[0], '| test accuracy: %.2f' % accuracy) @@ -78,7 +78,7 @@ for epoch in range(EPOCH): test_output = cnn(test_x[:10]) # !!!!!!!! Change in here !!!!!!!!! # -pred_y = torch.max(test_output, 1)[1].cuda().data.squeeze() # Move to CPU +pred_y = torch.max(test_output, 1)[1].cuda().data.squeeze() # move the computation in GPU print(pred_y, 'prediction number') print(test_y[:10], 'real number')