Sparse matrix bmm support

Hi ,

I would like to know how to implement such feature:

[Sparse A]_kmn Matrix Mutiply [Sparse B]_nd
->
[Sparse Result]_k
m*d

Qiwei Ye

I think we don’t have support for sparse bmm yet. If there is a CUDA implementation for it in cuBLAS, then we could eventually add it, if not it would involve quite some work.

A naive solution is to do a for loop though…

Thanks for your reply, I would like to implement it , but how could I utilize all the processes if I implement it by using a “for” loop?

If you don’t want to write code in C, the best bet is a for loop, eventually using multi-processing to parallelize over multiple elements of the batch? I’m not sure.

is there any way to create an Tensor that the 1d was dense and the rest was sparse? so that we can easily indexing.

I’m not sure I understand your question fully, but the sparse tensors in pytorch can have dense dimensions.