dgl.sparse.SparseMatrix.coo¶
-
SparseMatrix.
coo
() → Tuple[torch.Tensor, torch.Tensor][source]¶ Returns the coordinate list (COO) representation of the sparse matrix.
See COO in Wikipedia.
- Returns
torch.Tensor – Row coordinate
torch.Tensor – Column coordinate
Examples
>>> indices = torch.tensor([[1, 2, 1], [2, 4, 3]]) >>> A = dglsp.spmatrix(indices) >>> A.coo() (tensor([1, 2, 1]), tensor([2, 4, 3]))