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
d1eaa556
Unverified
Commit
d1eaa556
authored
Oct 11, 2021
by
Ningxin Zheng
Committed by
GitHub
Oct 11, 2021
Browse files
update (#4241)
parent
45048734
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
1 deletion
+1
-1
nni/compression/pytorch/speedup/infer_mask.py
nni/compression/pytorch/speedup/infer_mask.py
+1
-1
No files found.
nni/compression/pytorch/speedup/infer_mask.py
View file @
d1eaa556
...
@@ -102,6 +102,7 @@ class AutoMaskInference:
...
@@ -102,6 +102,7 @@ class AutoMaskInference:
self
.
weight_mask
=
{}
self
.
weight_mask
=
{}
if
weight_mask
:
if
weight_mask
:
self
.
weight_mask
.
update
(
weight_mask
)
self
.
weight_mask
.
update
(
weight_mask
)
self
.
name
=
name
if
isinstance
(
self
.
module
,
nn
.
Module
):
if
isinstance
(
self
.
module
,
nn
.
Module
):
# the function should not has parameters
# the function should not has parameters
# get all the parameter tensors of the target module
# get all the parameter tensors of the target module
...
@@ -109,7 +110,6 @@ class AutoMaskInference:
...
@@ -109,7 +110,6 @@ class AutoMaskInference:
self
.
weights
[
name
]
=
para
self
.
weights
[
name
]
=
para
if
name
not
in
self
.
weight_mask
:
if
name
not
in
self
.
weight_mask
:
self
.
weight_mask
[
name
]
=
torch
.
ones_like
(
para
.
data
)
self
.
weight_mask
[
name
]
=
torch
.
ones_like
(
para
.
data
)
self
.
name
=
name
self
.
state_dict
=
state_dict
self
.
state_dict
=
state_dict
# TODO support the other batch dimension in the future
# TODO support the other batch dimension in the future
self
.
batch_dim
=
batch_dim
self
.
batch_dim
=
batch_dim
...
...
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