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
torch-sparse
Commits
f00ca88b
Commit
f00ca88b
authored
Jan 25, 2020
by
rusty1s
Browse files
mark non differentiable
parent
729b4fb2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
0 deletions
+3
-0
torch_sparse/matmul.py
torch_sparse/matmul.py
+3
-0
No files found.
torch_sparse/matmul.py
View file @
f00ca88b
...
@@ -30,6 +30,7 @@ class SPMM(torch.autograd.Function):
...
@@ -30,6 +30,7 @@ class SPMM(torch.autograd.Function):
mat
,
arg_out
)
mat
,
arg_out
)
if
reduce
==
'min'
or
reduce
==
'max'
:
if
reduce
==
'min'
or
reduce
==
'max'
:
ctx
.
mark_non_differentiable
(
arg_out
)
return
out
,
arg_out
return
out
,
arg_out
else
:
else
:
return
out
return
out
...
@@ -123,6 +124,8 @@ class SPSPMM(torch.autograd.Function):
...
@@ -123,6 +124,8 @@ class SPSPMM(torch.autograd.Function):
colC
=
torch
.
from_numpy
(
C
.
col
).
to
(
torch
.
int64
)
colC
=
torch
.
from_numpy
(
C
.
col
).
to
(
torch
.
int64
)
indexC
=
torch
.
stack
([
rowC
,
colC
],
dim
=
0
)
indexC
=
torch
.
stack
([
rowC
,
colC
],
dim
=
0
)
ctx
.
mark_non_differentiable
(
indexC
,
rowptrC
)
# We cannot return `NoneType` in torch.autograd :(
# We cannot return `NoneType` in torch.autograd :(
if
valueC
is
None
:
if
valueC
is
None
:
return
indexC
,
rowptrC
return
indexC
,
rowptrC
...
...
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