Commit 56de8a6b authored by rusty1s's avatar rusty1s
Browse files

add backward test

parent 98c4d2c6
...@@ -30,10 +30,17 @@ def test_padded_index_select(device): ...@@ -30,10 +30,17 @@ def test_padded_index_select(device):
print('size', size) print('size', size)
print('length', length) print('length', length)
# x = torch.tensor([[0], [1], [2], [3]], dtype=torch.float, device=device) 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, x.requires_grad_()
# torch.tensor(0.)) out = torch.ops.torch_sparse.padded_index_select(x, col_perm,
# print(out) 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') dataset = Planetoid('/tmp/Planetoid', name='PubMed')
data = dataset[0] data = dataset[0]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment