This commit is contained in:
Morvan Zhou
2017-06-27 17:00:01 +10:00
committed by Morvan Zhou
parent 76c82cf670
commit 1b5fa9f7aa

View File

@ -71,7 +71,7 @@ for epoch in range(EPOCH):
# !!!!!!!! Change in here !!!!!!!!! # # !!!!!!!! Change in here !!!!!!!!! #
pred_y = torch.max(test_output, 1)[1].cuda().data.squeeze() # move the computation in GPU 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) print('Epoch: ', epoch, '| train loss: %.4f' % loss.data[0], '| test accuracy: %.2f' % accuracy)