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

Function test

examples/MVGRL_graph.py:96–113  ·  view source on GitHub ↗
(encoder_model, dataloader)

Source from the content-addressed store, hash-verified

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

Callers 1

mainFunction · 0.70

Calls 2

get_splitFunction · 0.90
SVMEvaluatorClass · 0.90

Tested by

no test coverage detected