dgl.sparse.SparseMatrix.csc
- SparseMatrix.csc() Tuple[Tensor, Tensor, Tensor] [source]
返回稀疏矩阵的压缩稀疏列(CSC)表示。
参见 CSC in Wikipedia.
此函数还返回一个索引张量作为值索引,表示CSC表示中非零元素值的顺序。一个
None
值索引数组表示值的顺序与SparseMatrix的值保持不变。- Returns:
torch.Tensor – 列索引指针
torch.Tensor – 行索引
torch.Tensor – 值索引
示例
>>> indices = torch.tensor([[1, 2, 1], [2, 4, 3]]) >>> A = dglsp.spmatrix(indices) >>> A.csc() (tensor([0, 0, 0, 1, 2, 3]), tensor([1, 1, 2]), tensor([0, 2, 1]))