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

Remove warnings generated in test_graphmask_explainer.py and test_laplacian_lambda_max.py #9179

Merged
merged 3 commits into from
Apr 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions torch_geometric/explain/algorithm/graphmask_explainer.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import math
from typing import List, Optional, Tuple, Union

import numpy as np
import torch
import torch.nn.functional as F
from torch import Tensor
Expand Down Expand Up @@ -162,7 +161,7 @@ def _hard_concrete(
(torch.log(u) - torch.log(1 - u) + input_element) / beta)

penalty = torch.sigmoid(input_element -
beta * np.math.log(-gamma / zeta))
beta * math.log(-gamma / zeta))
else:
s = torch.sigmoid(input_element)
penalty = torch.zeros_like(input_element)
Expand Down
2 changes: 1 addition & 1 deletion torch_geometric/transforms/laplacian_lambda_max.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def forward(self, data: Data) -> Data:
eig_fn = eigsh

lambda_max = eig_fn(L, k=1, which='LM', return_eigenvectors=False)
data.lambda_max = float(lambda_max.real)
data.lambda_max = lambda_max.real.item()

return data

Expand Down
Loading