Rewriting spdiags & spsolve?

I’m trying to rewrite some legacy code and switch from scipy to pytorch and I’m having difficulties re-writing the spdiags and spsolve.

How could I perform these operations on GPUs?

A = spdiags(B.T,d,k,k)

A = A + A.T + spdiags(D.T, 0, k, k)

return spsolve(A, input)

Hi,

I’m afraid we don’t have support for these functions on sparse Tensors.
You can check the sparse doc to see what is available.

You can use the Dense version of these methods though if this is not too memory intensive.
Also sparse operations will most likely be slower than dense ones on GPU (even though they use less memory).