"Extracting" the indices tensor from sparse torch tensor
Given a torch tensor A with sparse entries (say, for example, the adjacency matrix of a graph), we can construct a sparse tensor from A by using the function to_sparse().
For example:
A_sparse = A.to_sparse()
&gt;&gt;&gt; tensor(indices=tensor([[   0,    0,    0,  ..., 2707, 2707, 2707],
                       [ 633, 1862, 2582,  ...,  598, 1473, 2706]]),
       values=tensor([1., 1., 1.,  ..., 1., 1., 1.]),
       size=(2708, 2708), nnz=10556, layout=torch.sparse_coo)

But note that:
A_sparse.shape
&gt;&gt;&gt; torch.Size([2708, 2708])

What I would like is to only obtain the indices tensor in the above &quot;tuple&quot;, that is to say a tensor of shape (2,10556).
I have tried A_sparse[0]and A_sparce[indices] but neither method returns the expected result.

Following skyzip's comment, it is sufficient to call A_sparse.indices()
