Hi,
I am trying to use torch.mul() for a sparse tensor, but unfortunately the code below throws a run-time error:
a = torch.tensor([0.92], requires_grad=True)
i = torch.LongTensor([[0,0,0,0], [0,0,1,1], [0,0,2,2], [0,0,3,3]])
v = torch.FloatTensor([1, 2, 1, 1])
# A 4D sparse tensor
t = torch.sparse.FloatTensor(i.t(), v, torch.Size([2,2,5,5]))
# multiplication
y = torch.mul(a,t)
Error:
Traceback (most recent call last):
File "test3.py", line 59, in <module>
y = torch.mul(a,t)
RuntimeError: sparse tensors do not have strides
Is sparse matrix multiplication not supported at the moment?
Thanks