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]))