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
e428db54
Unverified
Commit
e428db54
authored
Oct 25, 2021
by
Panacea
Committed by
GitHub
Oct 25, 2021
Browse files
Fix [v2 sparsity_allocator] the way tensor expands (#4265)
parent
52c2d4d3
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
1 deletion
+1
-1
nni/algorithms/compression/v2/pytorch/pruning/tools/sparsity_allocator.py
...ompression/v2/pytorch/pruning/tools/sparsity_allocator.py
+1
-1
No files found.
nni/algorithms/compression/v2/pytorch/pruning/tools/sparsity_allocator.py
View file @
e428db54
...
...
@@ -80,7 +80,7 @@ class GlobalSparsityAllocator(SparsityAllocator):
stay_metric
=
torch
.
topk
(
metric
.
view
(
-
1
),
stay_metric_num
,
largest
=
False
)[
0
]
sub_thresholds
[
name
]
=
stay_metric
.
max
()
if
expend_times
>
1
:
stay_metric
=
stay_metric
.
expand
(
stay_metric_num
,
int
(
layer_weight_num
/
metric
.
numel
())).
view
(
-
1
)
stay_metric
=
stay_metric
.
expand
(
int
(
layer_weight_num
/
metric
.
numel
())
,
stay_metric_num
).
contiguous
(
).
view
(
-
1
)
metric_list
.
append
(
stay_metric
)
total_prune_num
=
int
(
total_sparsity
*
total_weight_num
)
...
...
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