pytorch - 💡(How to fix) Fix DISABLED test_modes_return_notimplemented (__main__.TestTorchFunctionMode) [1 comments, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
pytorch/pytorch#179692Fetched 2026-04-09 07:50:36
View on GitHub
Comments
1
Participants
1
Timeline
15
Reactions
0
Participants
Timeline (top)
mentioned ×5subscribed ×5labeled ×4commented ×1

Error Message

Traceback (most recent call last): File "/var/lib/jenkins/workspace/test/test_overrides.py", line 1479, in test_modes_return_notimplemented class MyMode(TorchFunctionMode): File "/var/lib/jenkins/workspace/test/test_overrides.py", line 1483, in torch_dynamo_resume_in_test_modes_return_notimplemented_at_1479 x = SubTensor() File "/opt/conda/envs/py_3.10/lib/python3.10/site-packages/torch/_dynamo/convert_frame.py", line 2396, in call result = self._torchdynamo_orig_backend( File "/opt/conda/envs/py_3.10/lib/python3.10/site-packages/torch/_dynamo/convert_frame.py", line 2119, in call result = self._inner_convert( File "/opt/conda/envs/py_3.10/lib/python3.10/site-packages/torch/_dynamo/convert_frame.py", line 726, in call result = _compile( File "/opt/conda/envs/py_3.10/lib/python3.10/site-packages/torch/_dynamo/convert_frame.py", line 1984, in _compile graph_node_shapes = output.get_graph_sizes_structured() File "/opt/conda/envs/py_3.10/lib/python3.10/site-packages/torch/_dynamo/output_graph.py", line 2350, in get_graph_sizes_structured ret[node.name] = [s if isinstance(s, int) else repr(s) for s in size] TypeError: 'int' object is not iterable

To execute this test, run the following from the base repo dir: PYTORCH_TEST_WITH_DYNAMO=1 python test/test_overrides.py TestTorchFunctionMode.test_modes_return_notimplemented

This message can be suppressed by setting PYTORCH_PRINT_REPRO_ON_FAILURE=0

Root Cause

This test was disabled because it is failing in CI. See recent examples and the most recent trunk workflow logs.

Code Example

Traceback (most recent call last):
  File "/var/lib/jenkins/workspace/test/test_overrides.py", line 1479, in test_modes_return_notimplemented
    class MyMode(TorchFunctionMode):
  File "/var/lib/jenkins/workspace/test/test_overrides.py", line 1483, in torch_dynamo_resume_in_test_modes_return_notimplemented_at_1479
    x = SubTensor()
  File "/opt/conda/envs/py_3.10/lib/python3.10/site-packages/torch/_dynamo/convert_frame.py", line 2396, in __call__
    result = self._torchdynamo_orig_backend(
  File "/opt/conda/envs/py_3.10/lib/python3.10/site-packages/torch/_dynamo/convert_frame.py", line 2119, in __call__
    result = self._inner_convert(
  File "/opt/conda/envs/py_3.10/lib/python3.10/site-packages/torch/_dynamo/convert_frame.py", line 726, in __call__
    result = _compile(
  File "/opt/conda/envs/py_3.10/lib/python3.10/site-packages/torch/_dynamo/convert_frame.py", line 1984, in _compile
    graph_node_shapes = output.get_graph_sizes_structured()
  File "/opt/conda/envs/py_3.10/lib/python3.10/site-packages/torch/_dynamo/output_graph.py", line 2350, in get_graph_sizes_structured
    ret[node.name] = [s if isinstance(s, int) else repr(s) for s in size]
TypeError: 'int' object is not iterable

To execute this test, run the following from the base repo dir:
    PYTORCH_TEST_WITH_DYNAMO=1 python test/test_overrides.py TestTorchFunctionMode.test_modes_return_notimplemented

This message can be suppressed by setting PYTORCH_PRINT_REPRO_ON_FAILURE=0
RAW_BUFFERClick to expand / collapse

Platforms: dynamo

This test was disabled because it is failing in CI. See recent examples and the most recent trunk workflow logs.

Over the past 6 hours, it has been determined flaky in 32 workflow(s) with 64 failures and 32 successes.

Debugging instructions (after clicking on the recent samples link): DO NOT ASSUME THINGS ARE OKAY IF THE CI IS GREEN. We now shield flaky tests from developers so CI will thus be green but it will be harder to parse the logs. To find relevant log snippets:

  1. Click on the workflow logs linked above
  2. Click on the Test step of the job so that it is expanded. Otherwise, the grepping will not work.
  3. Grep for test_modes_return_notimplemented
  4. There should be several instances run (as flaky tests are rerun in CI) from which you can study the logs.
<details><summary>Sample error message</summary>
Traceback (most recent call last):
  File "/var/lib/jenkins/workspace/test/test_overrides.py", line 1479, in test_modes_return_notimplemented
    class MyMode(TorchFunctionMode):
  File "/var/lib/jenkins/workspace/test/test_overrides.py", line 1483, in torch_dynamo_resume_in_test_modes_return_notimplemented_at_1479
    x = SubTensor()
  File "/opt/conda/envs/py_3.10/lib/python3.10/site-packages/torch/_dynamo/convert_frame.py", line 2396, in __call__
    result = self._torchdynamo_orig_backend(
  File "/opt/conda/envs/py_3.10/lib/python3.10/site-packages/torch/_dynamo/convert_frame.py", line 2119, in __call__
    result = self._inner_convert(
  File "/opt/conda/envs/py_3.10/lib/python3.10/site-packages/torch/_dynamo/convert_frame.py", line 726, in __call__
    result = _compile(
  File "/opt/conda/envs/py_3.10/lib/python3.10/site-packages/torch/_dynamo/convert_frame.py", line 1984, in _compile
    graph_node_shapes = output.get_graph_sizes_structured()
  File "/opt/conda/envs/py_3.10/lib/python3.10/site-packages/torch/_dynamo/output_graph.py", line 2350, in get_graph_sizes_structured
    ret[node.name] = [s if isinstance(s, int) else repr(s) for s in size]
TypeError: 'int' object is not iterable

To execute this test, run the following from the base repo dir:
    PYTORCH_TEST_WITH_DYNAMO=1 python test/test_overrides.py TestTorchFunctionMode.test_modes_return_notimplemented

This message can be suppressed by setting PYTORCH_PRINT_REPRO_ON_FAILURE=0
</details>

Test file path: test_overrides.py

For all disabled tests (by GitHub issue), see https://hud.pytorch.org/disabled.

cc @hameerabbasi @rgommers @ezyang @chauhang @penguinwu

extent analysis

TL;DR

The most likely fix involves addressing the 'int' object is not iterable error in the get_graph_sizes_structured method of output_graph.py.

Guidance

  • Investigate the get_graph_sizes_structured method in output_graph.py to determine why an integer is being passed where an iterable is expected.
  • Verify that the size variable in the get_graph_sizes_structured method is correctly formatted and contains the expected data type.
  • Check the test_modes_return_notimplemented test in test_overrides.py to see if there are any specific test cases or inputs that could be causing the error.
  • Run the test with the provided command PYTORCH_TEST_WITH_DYNAMO=1 python test/test_overrides.py TestTorchFunctionMode.test_modes_return_notimplemented to reproduce the error and gather more information.

Example

No code snippet is provided as the issue is related to a specific error in the PyTorch library, and modifying the code without more context could be potentially incorrect.

Notes

The error message suggests that there is an issue with the data type being passed to the get_graph_sizes_structured method. Without more information about the expected input and output of this method, it is difficult to provide a more specific solution.

Recommendation

Apply a workaround by modifying the get_graph_sizes_structured method to handle the case where an integer is passed instead of an iterable, or investigate and fix the root cause of why an integer is being passed in the first place.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING