Use sparse tensors with CUDA

Since PyTorch does not support indexing yet, I am doing some workarounds to do a repeated random split of a sparse matrix.

Now I am getting this error:

RuntimeError: Expected object of backend CUDA but got backend SparseCUDA for argument #2 ‘mat2’

There is not much documentation regarding the proper use of sparse tensors on CUDA. Does anybody know how to address this?

More specifically, what I am trying to do is to conver ta numpy COO sparse matrix to a PyTorch sparse FloatTensor as follows:

indices = np.vstack([coo.row, coo.col])
shape = coo.shape
values =
indices = torch.cuda.LongTensor(indices)
values = torch.cuda.FloatTensor(values)
# device = torch.cuda.device("cuda") if torch.cuda.is_available() else torch.device(0)
x = torch.cuda.sparse.FloatTensor(indices, values, torch.Size(shape))