f6532b3c4c329e6d5d5fb846acc441df47616c4c,examples/gnn_explainer.py,,,#,30

Before Change


    optimizer.zero_grad()
    log_logits = model(x, edge_index)
    loss = F.nll_loss(log_logits[data.train_mask], data.y[data.train_mask])
    print(loss)
    loss.backward()
    optimizer.step()

explainer = GNNExplainer(model, epochs=200)

After Change


model.load_state_dict(torch.load("/Users/rusty1s/Desktop/model.pt"))

explainer = GNNExplainer(model, epochs=200)
t = time.perf_counter()
node_feat_mask, edge_mask = explainer.explain_node(10, x, edge_index)
print(time.perf_counter() - t)
// for edge_mask in edge_masks:
//     mask = edge_mask > 0
//     print(edge_mask[mask])
// explainer.visualize_subgraph(10, edge_index, edge_masks)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 8

Instances


Project Name: rusty1s/pytorch_geometric
Commit Name: f6532b3c4c329e6d5d5fb846acc441df47616c4c
Time: 2020-03-22
Author: matthias.fey@tu-dortmund.de
File Name: examples/gnn_explainer.py
Class Name:
Method Name:


Project Name: hanxiao/bert-as-service
Commit Name: 23440472fbed6263ec7723a2c58b27c87cf55f62
Time: 2018-11-27
Author: hanhxiao@tencent.com
File Name: example4.py
Class Name:
Method Name:


Project Name: hanxiao/bert-as-service
Commit Name: e7ca574c2479137864e86b7c8e2555ded9a89bda
Time: 2018-11-27
Author: hanhxiao@tencent.com
File Name: example5.py
Class Name:
Method Name: