dgl.sparse.SparseMatrix.coo
- SparseMatrix.coo() Tuple[Tensor, Tensor] [source]
返回稀疏矩阵的坐标列表(COO)表示。
See COO in Wikipedia.
- Returns:
torch.Tensor – 行坐标
torch.Tensor – 列坐标
示例
>>> indices = torch.tensor([[1, 2, 1], [2, 4, 3]]) >>> A = dglsp.spmatrix(indices) >>> A.coo() (tensor([1, 2, 1]), tensor([2, 4, 3]))