pytorch - 💡(How to fix) Fix DISABLED test_autograd_functional_jvp_inside_transform_cpu (__main__.TestComposabilityCPU)

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…

Error Message

torch._dynamo.exc.TorchRuntimeError: RuntimeError when making fake tensor call Explanation: Dynamo failed to run FX node with fake tensors: call_function <built-in method ones_like of type object at 0x7f6600172a20>(*(GradTrackingTensor(lvl=1, value= FakeTensor(..., size=()) ),), **{}): got RuntimeError('tls_on_entry.has_value() INTERNAL ASSERT FAILED at "/__w/pytorch/pytorch/aten/src/ATen/core/PythonFallbackKernel.cpp":53, please report a bug to PyTorch. ') Hint: Your code may result in an error when running in eager. Please double check that your code doesn't contain a similar error when actually running eager/uncompiled. You can do this by removing the torch.compile call, or by using torch.compiler.set_stance("force_eager").

Developer debug context:

For more details about this graph break, please visit: https://meta-pytorch.github.io/compile-graph-break-site/gb/gb4315.html

from user code: File "/opt/conda/envs/py_3.14/lib/python3.14t/site-packages/torch/_functorch/apis.py", line 433, in wrapper return eager_transforms.grad_impl(func, argnums, has_aux, args, kwargs) File "/opt/conda/envs/py_3.14/lib/python3.14t/site-packages/torch/_functorch/eager_transforms.py", line 1533, in grad_impl results = grad_and_value_impl(func, argnums, has_aux, args, kwargs) File "/opt/conda/envs/py_3.14/lib/python3.14t/site-packages/torch/_functorch/vmap.py", line 56, in fn return f(*args, **kwargs) File "/opt/conda/envs/py_3.14/lib/python3.14t/site-packages/torch/_functorch/eager_transforms.py", line 1484, in grad_and_value_impl output = func(*args, **kwargs) File "/__w/pytorch/pytorch/test/functorch/test_eager_transforms.py", line 3740, in f t = torch.ones_like(x)

Set TORCHDYNAMO_VERBOSE=1 for the internal stack trace (please do this especially if you're reporting a bug to PyTorch). For even more developer context, set TORCH_LOGS="+dynamo"

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/__w/pytorch/pytorch/test/functorch/test_eager_transforms.py", line 3746, in test_autograd_functional_jvp_inside_transform with self.assertRaisesRegex(RuntimeError, "torch.autograd.functional"): File "/__w/pytorch/pytorch/test/functorch/test_eager_transforms.py", line 3750, in torch_dynamo_resume_in_test_autograd_functional_jvp_inside_transform_at_3746 with self.assertRaisesRegex(RuntimeError, "torch.autograd.functional"): ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/conda/envs/py_3.14/lib/python3.14t/unittest/case.py", line 285, in exit self._raiseFailure('"{}" does not match "{}"'.format( ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected_regex.pattern, str(exc_value))) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/conda/envs/py_3.14/lib/python3.14t/unittest/case.py", line 209, in _raiseFailure raise self.test_case.failureException(msg) AssertionError: "torch.autograd.functional" does not match "RuntimeError when making fake tensor call Explanation: Dynamo failed to run FX node with fake tensors: call_function <built-in method ones_like of type object at 0x7f6600172a20>(*(GradTrackingTensor(lvl=1, value= FakeTensor(..., size=()) ),), **{}): got RuntimeError('tls_on_entry.has_value() INTERNAL ASSERT FAILED at "/__w/pytorch/pytorch/aten/src/ATen/core/PythonFallbackKernel.cpp":53, please report a bug to PyTorch. ') Hint: Your code may result in an error when running in eager. Please double check that your code doesn't contain a similar error when actually running eager/uncompiled. You can do this by removing the torch.compile call, or by using torch.compiler.set_stance("force_eager").

Developer debug context:

For more details about this graph break, please visit: https://meta-pytorch.github.io/compile-graph-break-site/gb/gb4315.html

from user code: File "/opt/conda/envs/py_3.14/lib/python3.14t/site-packages/torch/_functorch/apis.py", line 433, in wrapper return eager_transforms.grad_impl(func, argnums, has_aux, args, kwargs) File "/opt/conda/envs/py_3.14/lib/python3.14t/site-packages/torch/_functorch/eager_transforms.py", line 1533, in grad_impl results = grad_and_value_impl(func, argnums, has_aux, args, kwargs) File "/opt/conda/envs/py_3.14/lib/python3.14t/site-packages/torch/_functorch/vmap.py", line 56, in fn return f(*args, **kwargs) File "/opt/conda/envs/py_3.14/lib/python3.14t/site-packages/torch/_functorch/eager_transforms.py", line 1484, in grad_and_value_impl output = func(*args, **kwargs) File "/__w/pytorch/pytorch/test/functorch/test_eager_transforms.py", line 3740, in f t = torch.ones_like(x)

Set TORCHDYNAMO_VERBOSE=1 for the internal stack trace (please do this especially if you're reporting a bug to PyTorch). For even more developer context, set TORCH_LOGS="+dynamo" "

To execute this test, run the following from the base repo dir: PYTORCH_TEST_WITH_DYNAMO=1 python test/functorch/test_eager_transforms.py TestComposabilityCPU.test_autograd_functional_jvp_inside_transform_cpu

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

torch._dynamo.exc.TorchRuntimeError: RuntimeError when making fake tensor call
  Explanation: Dynamo failed to run FX node with fake tensors: call_function <built-in method ones_like of type object at 0x7f6600172a20>(*(GradTrackingTensor(lvl=1, value=
        FakeTensor(..., size=())
    ),), **{}): got RuntimeError('tls_on_entry.has_value() INTERNAL ASSERT FAILED at "/__w/pytorch/pytorch/aten/src/ATen/core/PythonFallbackKernel.cpp":53, please report a bug to PyTorch. ')
  Hint: Your code may result in an error when running in eager. Please double check that your code doesn't contain a similar error when actually running eager/uncompiled. You can do this by removing the `torch.compile` call, or by using `torch.compiler.set_stance("force_eager")`. 

  Developer debug context: 

 For more details about this graph break, please visit: https://meta-pytorch.github.io/compile-graph-break-site/gb/gb4315.html

from user code:
   File "/opt/conda/envs/py_3.14/lib/python3.14t/site-packages/torch/_functorch/apis.py", line 433, in wrapper
    return eager_transforms.grad_impl(func, argnums, has_aux, args, kwargs)
  File "/opt/conda/envs/py_3.14/lib/python3.14t/site-packages/torch/_functorch/eager_transforms.py", line 1533, in grad_impl
    results = grad_and_value_impl(func, argnums, has_aux, args, kwargs)
  File "/opt/conda/envs/py_3.14/lib/python3.14t/site-packages/torch/_functorch/vmap.py", line 56, in fn
    return f(*args, **kwargs)
  File "/opt/conda/envs/py_3.14/lib/python3.14t/site-packages/torch/_functorch/eager_transforms.py", line 1484, in grad_and_value_impl
    output = func(*args, **kwargs)
  File "/__w/pytorch/pytorch/test/functorch/test_eager_transforms.py", line 3740, in f
    t = torch.ones_like(x)

Set TORCHDYNAMO_VERBOSE=1 for the internal stack trace (please do this especially if you're reporting a bug to PyTorch). For even more developer context, set TORCH_LOGS="+dynamo"


During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/__w/pytorch/pytorch/test/functorch/test_eager_transforms.py", line 3746, in test_autograd_functional_jvp_inside_transform
    with self.assertRaisesRegex(RuntimeError, "torch.autograd.functional"):
  File "/__w/pytorch/pytorch/test/functorch/test_eager_transforms.py", line 3750, in torch_dynamo_resume_in_test_autograd_functional_jvp_inside_transform_at_3746
    with self.assertRaisesRegex(RuntimeError, "torch.autograd.functional"):
         ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/envs/py_3.14/lib/python3.14t/unittest/case.py", line 285, in __exit__
    self._raiseFailure('"{}" does not match "{}"'.format(
    ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
             expected_regex.pattern, str(exc_value)))
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/envs/py_3.14/lib/python3.14t/unittest/case.py", line 209, in _raiseFailure
    raise self.test_case.failureException(msg)
AssertionError: "torch.autograd.functional" does not match "RuntimeError when making fake tensor call
  Explanation: Dynamo failed to run FX node with fake tensors: call_function <built-in method ones_like of type object at 0x7f6600172a20>(*(GradTrackingTensor(lvl=1, value=
        FakeTensor(..., size=())
    ),), **{}): got RuntimeError('tls_on_entry.has_value() INTERNAL ASSERT FAILED at "/__w/pytorch/pytorch/aten/src/ATen/core/PythonFallbackKernel.cpp":53, please report a bug to PyTorch. ')
  Hint: Your code may result in an error when running in eager. Please double check that your code doesn't contain a similar error when actually running eager/uncompiled. You can do this by removing the `torch.compile` call, or by using `torch.compiler.set_stance("force_eager")`. 

  Developer debug context: 

 For more details about this graph break, please visit: https://meta-pytorch.github.io/compile-graph-break-site/gb/gb4315.html

from user code:
   File "/opt/conda/envs/py_3.14/lib/python3.14t/site-packages/torch/_functorch/apis.py", line 433, in wrapper
    return eager_transforms.grad_impl(func, argnums, has_aux, args, kwargs)
  File "/opt/conda/envs/py_3.14/lib/python3.14t/site-packages/torch/_functorch/eager_transforms.py", line 1533, in grad_impl
    results = grad_and_value_impl(func, argnums, has_aux, args, kwargs)
  File "/opt/conda/envs/py_3.14/lib/python3.14t/site-packages/torch/_functorch/vmap.py", line 56, in fn
    return f(*args, **kwargs)
  File "/opt/conda/envs/py_3.14/lib/python3.14t/site-packages/torch/_functorch/eager_transforms.py", line 1484, in grad_and_value_impl
    output = func(*args, **kwargs)
  File "/__w/pytorch/pytorch/test/functorch/test_eager_transforms.py", line 3740, in f
    t = torch.ones_like(x)

Set TORCHDYNAMO_VERBOSE=1 for the internal stack trace (please do this especially if you're reporting a bug to PyTorch). For even more developer context, set TORCH_LOGS="+dynamo"
"

To execute this test, run the following from the base repo dir:
    PYTORCH_TEST_WITH_DYNAMO=1 python test/functorch/test_eager_transforms.py TestComposabilityCPU.test_autograd_functional_jvp_inside_transform_cpu

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 4 workflow(s) with 4 failures and 4 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_autograd_functional_jvp_inside_transform_cpu
  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>
torch._dynamo.exc.TorchRuntimeError: RuntimeError when making fake tensor call
  Explanation: Dynamo failed to run FX node with fake tensors: call_function <built-in method ones_like of type object at 0x7f6600172a20>(*(GradTrackingTensor(lvl=1, value=
        FakeTensor(..., size=())
    ),), **{}): got RuntimeError('tls_on_entry.has_value() INTERNAL ASSERT FAILED at "/__w/pytorch/pytorch/aten/src/ATen/core/PythonFallbackKernel.cpp":53, please report a bug to PyTorch. ')
  Hint: Your code may result in an error when running in eager. Please double check that your code doesn't contain a similar error when actually running eager/uncompiled. You can do this by removing the `torch.compile` call, or by using `torch.compiler.set_stance("force_eager")`. 

  Developer debug context: 

 For more details about this graph break, please visit: https://meta-pytorch.github.io/compile-graph-break-site/gb/gb4315.html

from user code:
   File "/opt/conda/envs/py_3.14/lib/python3.14t/site-packages/torch/_functorch/apis.py", line 433, in wrapper
    return eager_transforms.grad_impl(func, argnums, has_aux, args, kwargs)
  File "/opt/conda/envs/py_3.14/lib/python3.14t/site-packages/torch/_functorch/eager_transforms.py", line 1533, in grad_impl
    results = grad_and_value_impl(func, argnums, has_aux, args, kwargs)
  File "/opt/conda/envs/py_3.14/lib/python3.14t/site-packages/torch/_functorch/vmap.py", line 56, in fn
    return f(*args, **kwargs)
  File "/opt/conda/envs/py_3.14/lib/python3.14t/site-packages/torch/_functorch/eager_transforms.py", line 1484, in grad_and_value_impl
    output = func(*args, **kwargs)
  File "/__w/pytorch/pytorch/test/functorch/test_eager_transforms.py", line 3740, in f
    t = torch.ones_like(x)

Set TORCHDYNAMO_VERBOSE=1 for the internal stack trace (please do this especially if you're reporting a bug to PyTorch). For even more developer context, set TORCH_LOGS="+dynamo"


During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/__w/pytorch/pytorch/test/functorch/test_eager_transforms.py", line 3746, in test_autograd_functional_jvp_inside_transform
    with self.assertRaisesRegex(RuntimeError, "torch.autograd.functional"):
  File "/__w/pytorch/pytorch/test/functorch/test_eager_transforms.py", line 3750, in torch_dynamo_resume_in_test_autograd_functional_jvp_inside_transform_at_3746
    with self.assertRaisesRegex(RuntimeError, "torch.autograd.functional"):
         ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/envs/py_3.14/lib/python3.14t/unittest/case.py", line 285, in __exit__
    self._raiseFailure('"{}" does not match "{}"'.format(
    ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
             expected_regex.pattern, str(exc_value)))
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/envs/py_3.14/lib/python3.14t/unittest/case.py", line 209, in _raiseFailure
    raise self.test_case.failureException(msg)
AssertionError: "torch.autograd.functional" does not match "RuntimeError when making fake tensor call
  Explanation: Dynamo failed to run FX node with fake tensors: call_function <built-in method ones_like of type object at 0x7f6600172a20>(*(GradTrackingTensor(lvl=1, value=
        FakeTensor(..., size=())
    ),), **{}): got RuntimeError('tls_on_entry.has_value() INTERNAL ASSERT FAILED at "/__w/pytorch/pytorch/aten/src/ATen/core/PythonFallbackKernel.cpp":53, please report a bug to PyTorch. ')
  Hint: Your code may result in an error when running in eager. Please double check that your code doesn't contain a similar error when actually running eager/uncompiled. You can do this by removing the `torch.compile` call, or by using `torch.compiler.set_stance("force_eager")`. 

  Developer debug context: 

 For more details about this graph break, please visit: https://meta-pytorch.github.io/compile-graph-break-site/gb/gb4315.html

from user code:
   File "/opt/conda/envs/py_3.14/lib/python3.14t/site-packages/torch/_functorch/apis.py", line 433, in wrapper
    return eager_transforms.grad_impl(func, argnums, has_aux, args, kwargs)
  File "/opt/conda/envs/py_3.14/lib/python3.14t/site-packages/torch/_functorch/eager_transforms.py", line 1533, in grad_impl
    results = grad_and_value_impl(func, argnums, has_aux, args, kwargs)
  File "/opt/conda/envs/py_3.14/lib/python3.14t/site-packages/torch/_functorch/vmap.py", line 56, in fn
    return f(*args, **kwargs)
  File "/opt/conda/envs/py_3.14/lib/python3.14t/site-packages/torch/_functorch/eager_transforms.py", line 1484, in grad_and_value_impl
    output = func(*args, **kwargs)
  File "/__w/pytorch/pytorch/test/functorch/test_eager_transforms.py", line 3740, in f
    t = torch.ones_like(x)

Set TORCHDYNAMO_VERBOSE=1 for the internal stack trace (please do this especially if you're reporting a bug to PyTorch). For even more developer context, set TORCH_LOGS="+dynamo"
"

To execute this test, run the following from the base repo dir:
    PYTORCH_TEST_WITH_DYNAMO=1 python test/functorch/test_eager_transforms.py TestComposabilityCPU.test_autograd_functional_jvp_inside_transform_cpu

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

Test file path: functorch/test_eager_transforms.py

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

cc @chauhang @penguinwu @Chillee @samdow @kshitij12345

extent analysis

TL;DR

The test test_autograd_functional_jvp_inside_transform_cpu is failing due to a RuntimeError when making a fake tensor call, and the issue may be related to the use of torch.compile or eager mode.

Guidance

  • The error message suggests that the code may result in an error when running in eager mode, so try removing the torch.compile call or using torch.compiler.set_stance("force_eager") to verify this.
  • The issue may be related to the torch.ones_like function, which is called in the test_eager_transforms.py file, so investigate this function call and its inputs.
  • To get more information about the error, set TORCHDYNAMO_VERBOSE=1 and TORCH_LOGS="+dynamo" to enable verbose logging and debug output.
  • Run the test with PYTORCH_TEST_WITH_DYNAMO=1 to enable Dynamo testing and reproduce the error.

Example

No code example is provided as the issue is related to a specific test case and requires more investigation.

Notes

The issue is specific to the test_autograd_functional_jvp_inside_transform_cpu test case and may be related to the use of torch.compile or eager mode. The error message provides some hints and suggestions for debugging, but more investigation is needed to determine the root cause.

Recommendation

Apply workaround by removing torch.compile call or using torch.compiler.set_stance("force_eager") to verify if the issue is related to eager mode, as the error message suggests that the code may result in an error when running in eager mode.

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