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
0ac5dd62
Unverified
Commit
0ac5dd62
authored
Jul 20, 2020
by
Thor Johnsen
Committed by
GitHub
Jul 20, 2020
Browse files
Merge pull request #917 from a-maci/master
Fixing the case when grads are None
parents
3104fd59
089149d3
Changes
1
Hide 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 @
0ac5dd62
...
...
@@ -131,7 +131,8 @@ class ASP:
# prune gradients before step method
with
torch
.
no_grad
():
for
module_name
,
module
,
p_name
,
p
,
mask
,
pruned
in
cls
.
__sparse_parameters
:
p
.
grad
.
mul_
(
mask
)
if
p
.
grad
is
not
None
:
#thx pjudd
p
.
grad
.
mul_
(
mask
)
# call original optimizer step method
rval
=
opt_self
.
__step
(
*
args
,
**
kwargs
)
# prune parameters after step method
...
...
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