How to multiply a dense matrix by a sparse matrix element-wise in pytorch
I can use torch.sparse.mm() or torch.spmm() to do multiplication between sparse matrix and dense matrix directly, but which function should I choose to do element-wise multiplication?

You can implement this multiplication yourself

def sparse_dense_mul(s, d):
  i = s._indices()
  v = s._values()
  dv = d[i[0,:], i[1,:]]  # get values from relevant entries of dense matrix
  return torch.sparse.FloatTensor(i, v * dv, s.size())


Note that thanks to the linearity of the multiplication operation you do not need to worry if s is coalesced or not. 
