Unverified Commit 6a1f94d3 authored by yxy235's avatar yxy235 Committed by GitHub
Browse files

[Examples] Fix bugs of numpy in examples. (#6546)


Co-authored-by: default avatarUbuntu <ubuntu@ip-172-31-0-133.us-west-2.compute.internal>
parent 2e0eb7fc
......@@ -374,9 +374,9 @@ class BGNNPredictor:
# initialize for early stopping and metrics
if metric_name in ["r2", "accuracy"]:
best_metric = [np.float("-inf")] * 3 # for train/val/test
best_metric = [np.cfloat("-inf")] * 3 # for train/val/test
else:
best_metric = [np.float("inf")] * 3 # for train/val/test
best_metric = [np.cfloat("inf")] * 3 # for train/val/test
best_val_epoch = 0
epochs_since_last_best_metric = 0
......
......@@ -128,9 +128,9 @@ class GASDataset(DGLBuiltinDataset):
test_idx = index[
int(train_size * num_edges) : num_edges - int(val_size * num_edges)
]
train_mask = np.zeros(num_edges, dtype=np.bool)
val_mask = np.zeros(num_edges, dtype=np.bool)
test_mask = np.zeros(num_edges, dtype=np.bool)
train_mask = np.zeros(num_edges, dtype=np.bool_)
val_mask = np.zeros(num_edges, dtype=np.bool_)
test_mask = np.zeros(num_edges, dtype=np.bool_)
train_mask[train_idx] = True
val_mask[val_idx] = True
test_mask[test_idx] = True
......
......@@ -33,6 +33,7 @@ class ClusterIter(object):
else:
os.makedirs("./datasets/", exist_ok=True)
self.par_li = get_partition_list(g, psize)
self.par_li = np.array(self.par_li, dtype=object)
np.save(fn, self.par_li)
else:
self.par_li = get_partition_list(g, psize)
......
......@@ -39,6 +39,7 @@ class ClusterIter(object):
else:
os.makedirs("./datasets/", exist_ok=True)
self.par_li = get_partition_list(g, psize)
self.par_li = np.array(self.par_li, dtype=object)
np.save(fn, self.par_li)
else:
self.par_li = get_partition_list(g, psize)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment