-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Fixes for various warnings that appear in examples. #10357
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
Merged
Merged
+8
−8
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This was referenced Jul 11, 2025
puririshi98
added a commit
that referenced
this pull request
Jul 16, 2025
Follow-up to [PR#10357](#10357) and [PR#10360](#10360) to address and resolve the warnings similar to the following ones: ``` /workspace/examples/gat.py:66: UserWarning: Converting a tensor with requires_grad=True to a scalar may lead to unexpected behavior. Consider using tensor.detach() first. (Triggered internally at /opt/pytorch/pytorch/torch/csrc/autograd/generated/python_variable_methods.cpp:835.) return float(loss) /workspace/examples/proteins_gmt.py:68: UserWarning: Converting a tensor with requires_grad=True to a scalar may lead to unexpected behavior. Consider using tensor.detach() first. (Triggered internally at /opt/pytorch/pytorch/torch/csrc/autograd/generated/python_variable_methods.cpp:835.) total_loss += data.num_graphs * float(loss) ``` Co-authored-by: Rishi Puri <[email protected]>
puririshi98
approved these changes
Jul 16, 2025
Contributor
puririshi98
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
auto-merge was automatically disabled
July 16, 2025 17:36
Invalid email address
This was referenced Jul 16, 2025
puririshi98
added a commit
that referenced
this pull request
Jul 22, 2025
Follow-up to [PR#10357](#10357) to address and resolve the following remaining warning: ``` test/datasets/test_snap_dataset.py::test_ego_facebook_snap_dataset /usr/local/lib/python3.12/dist-packages/torch_geometric/data/in_memory_dataset.py:131: UserWarning: Weights only load failed. Please file an issue to make torch.load(weights_only=True) compatible in your case. Please use torch.serialization.add_safe_globals([torch_geometric.datasets.snap_dataset.EgoData]) to allowlist this global. out = fs.torch_load(path) ``` --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Rishi Puri <[email protected]>
puririshi98
pushed a commit
that referenced
this pull request
Jul 28, 2025
Follow-up to [PR#10357](#10357) to address and resolve the following warning: ``` /usr/local/lib/python3.12/dist-packages/torch_geometric/contrib/explain/pgm_explainer.py:154: UserWarning: Converting a tensor with requires_grad=True to a scalar may lead to unexpected behavior. Consider using tensor.detach() first. (Triggered internally at /opt/pytorch/pytorch/torch/csrc/autograd/generated/python_variable_methods.cpp:835.) sample[num_nodes] = pred_change ```
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR addresses several warnings that appear in the example scripts, including:
By resolving these issues, we aim to improve the clarity of the output and ensure better compatibility with future library versions. No changes to core logic or results are introduced.