Skip to content

Commit 1b5fa9f

Browse files
MorvanZhouMorvan Zhou
authored andcommitted
update
1 parent 76c82cf commit 1b5fa9f

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

tutorial-contents/502_GPU.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def forward(self, x):
7171
# !!!!!!!! Change in here !!!!!!!!! #
7272
pred_y = torch.max(test_output, 1)[1].cuda().data.squeeze() # move the computation in GPU
7373

74-
accuracy = sum(pred_y == test_y) / test_y.size(0)
74+
accuracy = torch.sum(pred_y == test_y) / test_y.size(0)
7575
print('Epoch: ', epoch, '| train loss: %.4f' % loss.data[0], '| test accuracy: %.2f' % accuracy)
7676

7777

0 commit comments

Comments
 (0)