Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
dcuai
dlexamples
Commits
e56b9b9e
Commit
e56b9b9e
authored
Jun 25, 2022
by
panning
Browse files
修复分类网络训练时tensor不连续报错
parent
ae5cea86
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
1 deletion
+1
-1
PyTorch/Compute-Vision/Accuracy_Validation/ResNet50/main_acc.py
...h/Compute-Vision/Accuracy_Validation/ResNet50/main_acc.py
+1
-1
No files found.
PyTorch/Compute-Vision/Accuracy_Validation/ResNet50/main_acc.py
View file @
e56b9b9e
...
@@ -501,7 +501,7 @@ def accuracy(output, target, topk=(1,)):
...
@@ -501,7 +501,7 @@ def accuracy(output, target, topk=(1,)):
res
=
[]
res
=
[]
for
k
in
topk
:
for
k
in
topk
:
correct_k
=
correct
[:
k
].
view
(
-
1
).
float
().
sum
(
0
,
keepdim
=
True
)
correct_k
=
correct
[:
k
].
contiguous
().
view
(
-
1
).
float
().
sum
(
0
,
keepdim
=
True
)
res
.
append
(
correct_k
.
mul_
(
100.0
/
batch_size
))
res
.
append
(
correct_k
.
mul_
(
100.0
/
batch_size
))
return
res
return
res
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment