diff --git a/tutorial-contents-notebooks/502_GPU.ipynb b/tutorial-contents-notebooks/502_GPU.ipynb index 37bdf0f..c85bf84 100644 --- a/tutorial-contents-notebooks/502_GPU.ipynb +++ b/tutorial-contents-notebooks/502_GPU.ipynb @@ -213,7 +213,7 @@ " # !!!!!!!! Change in here !!!!!!!!! #\n", " pred_y = torch.max(test_output, 1)[1].cuda().data.squeeze() # move the computation in GPU\n", "\n", - " accuracy = sum(pred_y == test_y) / test_y.size(0)\n", + " accuracy = torch.sum(pred_y == test_y).type(torch.FloatTensor) / test_y.size(0)\n", " print('Epoch: ', epoch, '| train loss: %.4f' % loss.data[0], '| test accuracy: %.2f' % accuracy)\n" ] },