dgl.sparse.SparseMatrix.coo
- SparseMatrix.coo() Tuple[Tensor, Tensor] [source]
返回稀疏矩阵的坐标列表 (COO) 表示。
请参阅维基百科中的 COO。
- 返回:
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]))