1 parent b312d95 commit d5e4fefCopy full SHA for d5e4fef
1 file changed
torch_cluster/graclus.py
@@ -39,6 +39,9 @@ def graclus_cluster(
39
row, col = row[mask], col[mask]
40
41
if weight is not None:
42
+ if (weight < 0).any().item():
43
+ raise ValueError(f"PyG's implementation of Graclus clustering "
44
+ f"does not support negative edge weights.")
45
weight = weight[mask]
46
47
# Randomly shuffle nodes.
@@ -51,9 +54,6 @@ def graclus_cluster(
51
54
row, col = row[perm], col[perm]
52
55
53
56
- if (weight < 0).any().item():
- raise ValueError(f"PyG's implementation of Graclus clustering "
- f"does not support negative edge weights.")
57
weight = weight[perm]
58
59
deg = row.new_zeros(num_nodes)
0 commit comments