dgl.sparse.SparseMatrix.has_duplicateο
- SparseMatrix.has_duplicate()[source]ο
Returns
True
if the sparse matrix contains duplicate indices.Examples
>>> 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