Solved by gil_bc in post #7 
              
              
                Well, I managed to make this run, though not by fixing the error I had. 
I just didn’t use the SparseMM function at all, instead I used this: 
torch.sparse.mm(D, x.t()).t() 
from: 
 

@Caruso thanks again for the help!