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:

  
      pytorch.org
  
  
    

torch.sparse — PyTorch 1.6.0 documentation 13



  
  
    
    
  
  


@Caruso thanks again for the help!