Sum operation on torch.sparse.FloatTensor

I would like to do .sum(dim) operation on torch.sparse.FloatTensor before I turn it to dense, due to memory issues, I don’t have enough space to turn it to dense first.

I got “TypeError: Type torch.sparse.FloatTensor doesn’t implement stateless method sum”

Is there any work around to do it without blowing up memory. Also, since the matrix is very large, for loop is too slow.

I think here are the main options:


Since now Caffe2 is going to become the back end of PyTorch, will it break the C++ extension mechanism?