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
56de8a6b
Commit
56de8a6b
authored
Apr 05, 2020
by
rusty1s
Browse files
add backward test
parent
98c4d2c6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
4 deletions
+11
-4
test/test_degree_padding2.py
test/test_degree_padding2.py
+11
-4
No files found.
test/test_degree_padding2.py
View file @
56de8a6b
...
...
@@ -30,10 +30,17 @@ def test_padded_index_select(device):
print
(
'size'
,
size
)
print
(
'length'
,
length
)
# x = torch.tensor([[0], [1], [2], [3]], dtype=torch.float, device=device)
# out = torch.ops.torch_sparse.padded_index_select(x, adj.storage.col(), idx,
# torch.tensor(0.))
# print(out)
x
=
torch
.
tensor
([[
0
],
[
1
],
[
2
],
[
3
]],
dtype
=
torch
.
float
,
device
=
device
)
x
.
requires_grad_
()
out
=
torch
.
ops
.
torch_sparse
.
padded_index_select
(
x
,
col_perm
,
torch
.
tensor
(
0.
))
print
(
out
)
grad_out
=
torch
.
tensor
(
[[
0
],
[
1
],
[
2
],
[
3
],
[
4
],
[
5
],
[
6
],
[
7
],
[
8
],
[
9
],
[
10
],
[
11
]],
dtype
=
torch
.
float
,
device
=
device
)
out
.
backward
(
grad_out
)
print
(
x
.
grad
)
dataset
=
Planetoid
(
'/tmp/Planetoid'
,
name
=
'PubMed'
)
data
=
dataset
[
0
]
...
...
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