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
OpenDAS
apex
Commits
089149d3
Unverified
Commit
089149d3
authored
Jul 20, 2020
by
Asit
Committed by
GitHub
Jul 20, 2020
Browse files
Merge pull request #2 from a-maci/a-maci-patch-1
Fixing mask multiplication with grad tensors
parents
3dd36070
774de913
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
1 deletion
+2
-1
apex/contrib/sparsity/asp.py
apex/contrib/sparsity/asp.py
+2
-1
No files found.
apex/contrib/sparsity/asp.py
View file @
089149d3
...
@@ -131,6 +131,7 @@ class ASP:
...
@@ -131,6 +131,7 @@ class ASP:
# prune gradients before step method
# prune gradients before step method
with
torch
.
no_grad
():
with
torch
.
no_grad
():
for
module_name
,
module
,
p_name
,
p
,
mask
,
pruned
in
cls
.
__sparse_parameters
:
for
module_name
,
module
,
p_name
,
p
,
mask
,
pruned
in
cls
.
__sparse_parameters
:
if
p
.
grad
is
not
None
:
#thx pjudd
p
.
grad
.
mul_
(
mask
)
p
.
grad
.
mul_
(
mask
)
# call original optimizer step method
# call original optimizer step method
rval
=
opt_self
.
__step
(
*
args
,
**
kwargs
)
rval
=
opt_self
.
__step
(
*
args
,
**
kwargs
)
...
...
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