We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 76c82cf commit 1b5fa9fCopy full SHA for 1b5fa9f
1 file changed
tutorial-contents/502_GPU.py
@@ -71,7 +71,7 @@ def forward(self, x):
71
# !!!!!!!! Change in here !!!!!!!!! #
72
pred_y = torch.max(test_output, 1)[1].cuda().data.squeeze() # move the computation in GPU
73
74
- accuracy = sum(pred_y == test_y) / test_y.size(0)
+ accuracy = torch.sum(pred_y == test_y) / test_y.size(0)
75
print('Epoch: ', epoch, '| train loss: %.4f' % loss.data[0], '| test accuracy: %.2f' % accuracy)
76
77
0 commit comments