pytorch_sparse icon indicating copy to clipboard operation
pytorch_sparse copied to clipboard

How the malmul works in this library?

Open pigu163 opened this issue 11 months ago • 1 comments
trafficstars

Hi, I am using pytorch_sparse matmul, but see abnormal result

from torch_sparse import SparseTensor, matmul

x [batch, features, nodes, step]

x = torch.rand(100, 20, 3, 24) adj = torch.eye(100,100) adj = SparseTensor.from_dense(adj) out = adj.matmul(x) --> torch.Size([100, 20, 100, 24])

@rusty1s Generally, sparse matrix (100, 100), it can't directly multiply with the (3, 24) dimensions because the dimensions don't align properly for matrix multiplication, but there is no error pop up. If this operator same as torch.matmul, and also follow their broadcast rules, it shouldn't be like this. Is there any explanation for this operator ?

Beside, torch.matmut has bug on broadcast sparse.matrix times dense.matrix since torch verison >= 2.0.1

pigu163 avatar Dec 11 '24 14:12 pigu163