Skip to content

Commit

Permalink
Test CaptumExplainer and GNNExplainer with unused parameters (#9216)
Browse files Browse the repository at this point in the history
  • Loading branch information
rusty1s committed Apr 19, 2024
1 parent 557d063 commit ed17034
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions test/explain/algorithm/test_captum_explainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ def __init__(self, model_config: ModelConfig):
self.conv1 = GCNConv(3, 16)
self.conv2 = GCNConv(16, out_channels)

# Add unused parameter:
self.param = torch.nn.Parameter(torch.empty(1))

def forward(self, x, edge_index, batch=None, edge_label_index=None):
x = self.conv1(x, edge_index).relu()
x = self.conv2(x, edge_index)
Expand Down
3 changes: 3 additions & 0 deletions test/explain/algorithm/test_gnn_explainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ def __init__(self, model_config: ModelConfig):
self.conv1 = GCNConv(3, 16)
self.conv2 = GCNConv(16, out_channels)

# Add unused parameter:
self.param = torch.nn.Parameter(torch.empty(1))

def forward(self, x, edge_index, batch=None, edge_label_index=None):
x = self.conv1(x, edge_index).relu()
x = self.conv2(x, edge_index)
Expand Down

0 comments on commit ed17034

Please sign in to comment.