Skip to content

Fix: Replace non-tuple indexing to resolve PyTorch deprecation warning #10389

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 4 commits into from
Aug 7, 2025

Conversation

drivanov
Copy link
Contributor

PR fixes the following warnings:

test/data/test_large_graph_indexer.py::test_large_graph_index
  /usr/local/lib/python3.12/dist-packages/torch_geometric/data/large_graph_indexer.py:300: UserWarning: Using a non-tuple 
sequence for multidimensional indexing is deprecated and will be changed in pytorch 2.9; use x[tuple(seq)] instead of 
x[seq]. In pytorch 2.9 this will be interpreted as tensor index, x[torch.tensor(seq)], which will result either in 
an error or a different result (Triggered internally at /opt/pytorch/pytorch/torch/csrc/autograd/python_variable_indexing.cpp:296.)
    return values[idxs]

test/data/test_large_graph_indexer.py::test_large_graph_index
  /usr/local/lib/python3.12/dist-packages/torch_geometric/data/large_graph_indexer.py:424: UserWarning: Using a non-tuple 
sequence for multidimensional indexing is deprecated and will be changed in pytorch 2.9; use x[tuple(seq)] instead of 
x[seq]. In pytorch 2.9 this will be interpreted as tensor index, x[torch.tensor(seq)], which will result either in 
an error or a different result (Triggered internally at /opt/pytorch/pytorch/torch/csrc/autograd/python_variable_indexing.cpp:296.)
    return values[idxs]

@drivanov drivanov requested a review from mananshah99 as a code owner July 30, 2025 19:09
Copy link

codecov bot commented Jul 30, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.83%. Comparing base (c211214) to head (9b96fc9).
⚠️ Report is 81 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #10389      +/-   ##
==========================================
- Coverage   86.11%   85.83%   -0.28%     
==========================================
  Files         496      501       +5     
  Lines       33655    34454     +799     
==========================================
+ Hits        28981    29574     +593     
- Misses       4674     4880     +206     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Contributor

@puririshi98 puririshi98 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@puririshi98 puririshi98 merged commit 16486ed into pyg-team:master Aug 7, 2025
19 checks passed
@drivanov drivanov deleted the non-tuple_seq branch August 9, 2025 18:23
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.

2 participants