MCPcopy Index your code
hub / github.com/PyGCL/PyGCL / test

Function test

examples/GraphCL.py:90–107  ·  view source on GitHub ↗
(encoder_model, dataloader)

Source from the content-addressed store, hash-verified

88
89
90def test(encoder_model, dataloader):
91 encoder_model.eval()
92 x = []
93 y = []
94 for data in dataloader:
95 data = data.to('cuda')
96 if data.x is None:
97 num_nodes = data.batch.size(0)
98 data.x = torch.ones((num_nodes, 1), dtype=torch.float32, device=data.batch.device)
99 _, g, _, _, _, _ = encoder_model(data.x, data.edge_index, data.batch)
100 x.append(g)
101 y.append(data.y)
102 x = torch.cat(x, dim=0)
103 y = torch.cat(y, dim=0)
104
105 split = get_split(num_samples=x.size()[0], train_ratio=0.8, test_ratio=0.1)
106 result = SVMEvaluator(linear=True)(x, y, split)
107 return result
108
109
110def main():

Callers 1

mainFunction · 0.70

Calls 2

get_splitFunction · 0.90
SVMEvaluatorClass · 0.90

Tested by

no test coverage detected