Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a109f85

Browse files
authored
use reshape instead of view (#971)
1 parent 4a1fa2c commit a109f85

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

examples/imagenet/main_amp.py

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

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

0 commit comments

Comments
 (0)