dgl.sparse.SparseMatrix.coo๏ƒ

SparseMatrix.coo() โ†’ Tuple[Tensor, 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]))