Skip to content

Commit

Permalink
use reshape instead of view in accuracy
Browse files Browse the repository at this point in the history
  • Loading branch information
ngimel authored and soumith committed Sep 2, 2020
1 parent 4b119d7 commit 49e1a88
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion imagenet/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ def accuracy(output, target, topk=(1,)):

res = []
for k in topk:
correct_k = correct[:k].view(-1).float().sum(0, keepdim=True)
correct_k = correct[:k].reshape(-1).float().sum(0, keepdim=True)
res.append(correct_k.mul_(100.0 / batch_size))
return res

Expand Down

0 comments on commit 49e1a88

Please sign in to comment.