Skip to content

How the malmul works in this library? #393

Open
@pigu163

Description

@pigu163

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions