Skip to content

Commit 3e2d0b8

Browse files
committed
update for new version of torch
1 parent 0f4219c commit 3e2d0b8

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

tutorial-contents-notebooks/502_GPU.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@
213213
" # !!!!!!!! Change in here !!!!!!!!! #\n",
214214
" pred_y = torch.max(test_output, 1)[1].cuda().data.squeeze() # move the computation in GPU\n",
215215
"\n",
216-
" accuracy = sum(pred_y == test_y) / test_y.size(0)\n",
216+
" accuracy = torch.sum(pred_y == test_y).type(torch.FloatTensor) / test_y.size(0)\n",
217217
" print('Epoch: ', epoch, '| train loss: %.4f' % loss.data[0], '| test accuracy: %.2f' % accuracy)\n"
218218
]
219219
},

0 commit comments

Comments
 (0)