title: Column/row slicing a torch sparse tensor
body: <p>I have a pytorch sparse tensor that I need sliced row/column wise using this slice <code>[idx][:,idx]</code> where <code>idx</code> is a list of indexes, using the mentioned slice yields my desired result on an ordinary float tensor. Is it possible applying the same slicing on a sparse tensor? Example here:</p>
  
  <pre><code>#constructing sparse matrix
  i = np.array([[0,1,2,2],[0,1,2,1]])
  v = np.ones(4)
  i = torch.from_numpy(i.astype("int64"))
  v = torch.from_numpy(v.astype("float32"))
  test1 = torch.sparse.FloatTensor(i, v)
  
  #constructing float tensor
  test2 = np.array([[1,0,0],[0,1,0],[0,1,1]])
  test2 = autograd.Variable(torch.cuda.FloatTensor(test2), requires_grad=False)
  
  #slicing
  idx = [1,2]
  print(test2[idx][:,idx])
  </code></pre>
  
  <p>output:</p>
  
  <pre><code>Variable containing:
   1  0
   1  1
  [torch.cuda.FloatTensor of size 2x2 (GPU 0)]
  </code></pre>
  
  <p>I am holding a 250.000 x 250.000 adjacency matrix, where I need to slice <code>n</code> rows and <code>n</code> columns, using the random idx, by simply sampling <code>n</code> random idx's. Since the dataset is so large it is not realistic to convert to a more convenient datatype.</p>
  
  <p>can I achieve the same slicing result on test1? Is it even possible? If not, are there any work-arounds?</p>
  
  <p>Right now I am running my model with the following "hack" of a solution:</p>
  
  <pre><code>idx = sorted(random.sample(range(0, np.shape(test1)[0]), 9000))
  test1 = test1AsCsr[idx][:,idx].todense().astype("int32")
  test1 = autograd.Variable(torch.cuda.FloatTensor(test1), requires_grad=False)
  </code></pre>
  
  <p>Where test1AsCsr is my test1 converted to a numpy CSR matrix. This solution works, it is however very slow, and makes my GPU utilization very low, since it needs to read/write from CPU memory, constantly.</p>
  
  <p>Edit: Its fine with a non-sparse tensor as result</p>