pytorch_sparse
pytorch_sparse copied to clipboard
Problem when passing a SparseTensor to PyG GCNconv
The problem occured when I try to pass a SparseTensor to PyG GCNconv. I'm working with python 3.10, cuda 12.1, torch 2.2.0, PyG 2.5.2 and torch_sparse 0.6.18 installed by conda on a ubuntu server, then things didn't work well. No matter how I change the way to create the SparseTensor object, the problem just persists. I'm wondering whether the problem comes from some version compatibility issues or there's something wrong in my environment setting(very simple because I just installed torch pyg and torch_sparse). Does anyone meet similar problem or get some idea on why this issue takes place?
I think you can reproduce the issue by running following code:
def test():
ei = torch.tensor([[2, 3, 4], [1, 2, 3]]).cuda(0)
sp = SparseTensor.from_edge_index(ei, sparse_sizes=(5, 5))
model = GCNConv(2, 2).cuda(0)
x = torch.tensor([[1, 1], [1, 1], [1, 1], [1, 1], [1, 1]]).float().cuda(0)
print(x, sp)
model(x, sp)
print('success')
test()
Here is the error message:
Traceback (most recent call last):
File "/.../debug.py", line 15, in