开始使用
先进材料
API 参考
SparseMatrix
注释
杂项
如果稀疏矩阵包含重复的索引,则返回 True。
True
示例
>>> indices = torch.tensor([[1, 0, 0, 0, 1], [1, 1, 1, 2, 2]]) >>> val = torch.tensor([0, 1, 2, 3, 4]) >>> A = dglsp.spmatrix(indices, val) >>> A.has_duplicate() True >>> A.coalesce().has_duplicate() False