Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenDAS
nni
Commits
cae1e6d4
Unverified
Commit
cae1e6d4
authored
Aug 21, 2021
by
lin bin
Committed by
GitHub
Aug 21, 2021
Browse files
[Model Compression] fix data contiguous bug in amc example (#4049)
parent
c0385c57
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
1 deletion
+1
-1
examples/model_compress/pruning/amc/utils.py
examples/model_compress/pruning/amc/utils.py
+1
-1
No files found.
examples/model_compress/pruning/amc/utils.py
View file @
cae1e6d4
...
@@ -49,7 +49,7 @@ def accuracy(output, target, topk=(1, 5)):
...
@@ -49,7 +49,7 @@ def accuracy(output, target, topk=(1, 5)):
res
=
[]
res
=
[]
for
k
in
topk
:
for
k
in
topk
:
correct_k
=
correct
[:
k
].
view
(
-
1
).
float
().
sum
(
0
)
correct_k
=
correct
[:
k
].
contiguous
().
view
(
-
1
).
float
().
sum
(
0
)
res
.
append
(
correct_k
.
mul_
(
100.0
/
batch_size
))
res
.
append
(
correct_k
.
mul_
(
100.0
/
batch_size
))
return
res
+
appendices
return
res
+
appendices
...
...
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