Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gnnexplainer graph-explanation fix. #2615

Merged
merged 2 commits into from
May 21, 2021
Merged

Conversation

wsad1
Copy link
Member

@wsad1 wsad1 commented May 21, 2021

Bug

explainer = GNNExplainer(model, epochs=200)
explainer.explain_graph(x, edge_index) 
explainer.visualize_subgraph(node_idx=-1,edge_index, edge_mask, y=torch.tensor(4))

Running above code throws IndexError: too many indices for tensor of dimension 0 at y = y[subset].to(torch.float) / y.max().item() inside visualize_subgraph.

Fix

y is set to None inside visualize_subgraph for graph explanation task. And all nodes will have the same color in this case.

Thanks @Luoyunsong for bringing this up.

@codecov-commenter
Copy link

codecov-commenter commented May 21, 2021

Codecov Report

Merging #2615 (ca7b282) into master (e2abb69) will increase coverage by 0.28%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2615      +/-   ##
==========================================
+ Coverage   83.62%   83.90%   +0.28%     
==========================================
  Files         205      205              
  Lines        9228     9229       +1     
==========================================
+ Hits         7717     7744      +27     
+ Misses       1511     1485      -26     
Impacted Files Coverage Δ
torch_geometric/nn/models/gnn_explainer.py 94.33% <100.00%> (+16.49%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e2abb69...ca7b282. Read the comment docs.

@rusty1s rusty1s merged commit ea9880a into pyg-team:master May 21, 2021
@wsad1 wsad1 deleted the gnnexpfix branch May 21, 2021 11:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants