-
Notifications
You must be signed in to change notification settings - Fork 10
/
make.py
43 lines (31 loc) · 1.26 KB
/
make.py
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
31
32
33
34
35
36
37
38
39
40
41
42
43
import os.path as osp
import numpy as np
import features
import torch
from torch_geometric.data import Data, Dataset
class MyOwnDataset(Dataset):
def __init__(self, root, transform=None, pre_transform=None):
super(MyOwnDataset, self).__init__(root, transform, pre_transform)
@property
def raw_file_names(self):
return ["single file"]
@property
def processed_file_names(self):
return ["single file"]
def __len__(self):
return len(self.processed_file_names)
def download(self):
self = self.raw_dir
def process(self):
i = 0
for raw_path in self.raw_paths:
# Read data from `raw_path`.
for node_attr, edge_index, edge_attr, target in features.return_data(features.data_instance):
data = Data(node_attr, edge_index, edge_attr, target)
if self.pre_filter is not None and not self.pre_filter(data):
continue
if self.pre_transform is not None:
data = self.pre_transform(data)
torch.save(data, osp.join(self.processed_dir, 'data_{}.pth'.format(i)))
i += 1
d = MyOwnDataset(root=r"C:\Users\Flawnson\Documents\Project Seraph & Cherub\Project Outcome\datasets")