db28ee240981457335c6fd9c38e542066df214cb,examples/cluster_gcn.py,,test,#,59
Before Change
logits = model(data.x, data.edge_index)
accs = []
for _, mask in data("train_mask", "val_mask", "test_mask"):
pred = logits[mask].max(1)[1]
acc = pred.eq(data.y[mask]).sum().item() / mask.sum().item()
accs.append(acc)
return accs
After Change
@torch.no_grad()
def test():
model.eval()
total_correct, total_nodes = [0, 0, 0], [0, 0, 0]
for data in test_loader:
data = data.to(device)
logits = model(data.x, data.edge_index)
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 3
Instances
Project Name: rusty1s/pytorch_geometric
Commit Name: db28ee240981457335c6fd9c38e542066df214cb
Time: 2020-02-19
Author: matthias.fey@tu-dortmund.de
File Name: examples/cluster_gcn.py
Class Name:
Method Name: test
Project Name: OpenNMT/OpenNMT-py
Commit Name: 0e7bfac76b97e7630102687f7e6309e00e190091
Time: 2018-11-13
Author: benzurdopeters@gmail.com
File Name: onmt/translate/translator.py
Class Name: Translator
Method Name: _score_target
Project Name: rusty1s/pytorch_geometric
Commit Name: 776f891afa3e7bfe2ae456c064e0867c4987c762
Time: 2020-06-30
Author: matthias.fey@tu-dortmund.de
File Name: examples/rgcn.py
Class Name:
Method Name: test