MCPcopy Index your code
hub / github.com/dmlc/dgl / evaluate

Function evaluate

examples/core/graphsage/node_classification.py:53–61  ·  view source on GitHub ↗
(g, features, labels, mask, model)

Source from the content-addressed store, hash-verified

51
52
53def evaluate(g, features, labels, mask, model):
54 model.eval()
55 with torch.no_grad():
56 logits = model(g, features)
57 logits = logits[mask]
58 labels = labels[mask]
59 _, indices = torch.max(logits, dim=1)
60 correct = torch.sum(indices == labels)
61 return correct.item() * 1.0 / len(labels)
62
63
64def train(g, features, labels, masks, model):

Callers 2

trainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected