MCPcopy Create free account
hub / github.com/pytorch/examples / test

Function test

gcn/main.py:189–197  ·  view source on GitHub ↗
(model, criterion, input, target, mask)

Source from the content-addressed store, hash-verified

187
188
189def test(model, criterion, input, target, mask):
190 model.eval()
191 with torch.no_grad():
192 output = model(*input)
193 output, target = output[mask], target[mask]
194
195 loss = criterion(output, target)
196 acc = (output.argmax(dim=1) == target).float().sum() / len(target)
197 return loss.item(), acc.item()
198
199
200if __name__ == '__main__':

Callers 2

train_iterFunction · 0.70
main.pyFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected