dgl.sparse.SparseMatrix.indices

SparseMatrix.indices() Tensor[source]

Returns the coordinate list (COO) representation in one tensor with shape (2, nnz).

See COO in Wikipedia.

Returns:

Stacked COO tensor with shape (2, nnz).

Return type:

torch.Tensor

Examples

>>> indices = torch.tensor([[1, 2, 1], [2, 4, 3]])
>>> A = dglsp.spmatrix(indices)
>>> A.indices()
tensor([[1, 2, 1],
        [2, 4, 3]])