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

Function test

examples/InfoGraph.py:98–115  ·  view source on GitHub ↗
(encoder_model, dataloader)

Source from the content-addressed store, hash-verified

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

Callers 1

mainFunction · 0.70

Calls 2

get_splitFunction · 0.90
SVMEvaluatorClass · 0.90

Tested by

no test coverage detected