-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdatasets.py
More file actions
30 lines (22 loc) · 767 Bytes
/
datasets.py
File metadata and controls
30 lines (22 loc) · 767 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import os
import pickle
import itertools
def build_dataset(args, is_train = True):
data_dir = args.data_dir if is_train else args.eval_data_dir
dataset = []
for root, folder, files in os.walk(data_dir):
for file in files:
if (file.endswith("pickle")):
pkl_path = os.path.join(root, file)
infile = open(pkl_path, "rb")
graphs = pickle.load(infile)
dataset.append(graphs)
dataset = list(itertools.chain(*dataset))
dataset = transform_dataset(args,dataset)
return dataset
def transform_dataset(args,dataset : list):
if args.add_general_sink_node:
pass
if args.add_self_loop:
pass
return dataset