Skip to content

Commit 763babb

Browse files
authored
Merge pull request #268 from creeky123/master
Fix to accuracy function
2 parents 5e23328 + 7812a49 commit 763babb

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

examples/imagenet/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ def accuracy(output, target, topk=(1,)):
434434

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

0 commit comments

Comments
 (0)