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

Function test

examples/BGRL_G2L.py:139–157  ·  view source on GitHub ↗
(encoder_model, dataloader)

Source from the content-addressed store, hash-verified

137
138
139def test(encoder_model, dataloader):
140 encoder_model.eval()
141 x = []
142 y = []
143 for data in dataloader:
144 data = data.to('cuda')
145 if data.x is None:
146 num_nodes = data.batch.size(0)
147 data.x = torch.ones((num_nodes, 1), dtype=torch.float32, device=data.batch.device)
148 g1, g2, _, _, _, _ = encoder_model(data.x, data.edge_index, batch=data.batch)
149 z = torch.cat([g1, g2], dim=1)
150 x.append(z)
151 y.append(data.y)
152 x = torch.cat(x, dim=0)
153 y = torch.cat(y, dim=0)
154
155 split = get_split(num_samples=x.size()[0], train_ratio=0.8, test_ratio=0.1)
156 result = SVMEvaluator(linear=True)(x, y, split)
157 return result
158
159
160def main():

Callers 1

mainFunction · 0.70

Calls 2

get_splitFunction · 0.90
SVMEvaluatorClass · 0.90

Tested by

no test coverage detected