Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit e612f2e

Browse files
Merge pull request #268 from creeky123/master
Fix to accuracy function
2 parents 246c1fe + 7c1e3ca commit e612f2e

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)

AltStyle によって変換されたページ (->オリジナル) /