update for new version of torch
This commit is contained in:
@ -213,7 +213,7 @@
|
|||||||
" # !!!!!!!! Change in here !!!!!!!!! #\n",
|
" # !!!!!!!! Change in here !!!!!!!!! #\n",
|
||||||
" pred_y = torch.max(test_output, 1)[1].cuda().data.squeeze() # move the computation in GPU\n",
|
" pred_y = torch.max(test_output, 1)[1].cuda().data.squeeze() # move the computation in GPU\n",
|
||||||
"\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"
|
" print('Epoch: ', epoch, '| train loss: %.4f' % loss.data[0], '| test accuracy: %.2f' % accuracy)\n"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user