pytorch - 💡(How to fix) Fix DISABLED test_vmap_grad_sum_cpu (__main__.TestHigherOrderOperatorInteractionCPU) [2 comments, 2 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#181683Fetched 2026-04-28 06:23:51
View on GitHub
Comments
2
Participants
2
Timeline
16
Reactions
0
Timeline (top)
mentioned ×5subscribed ×5labeled ×4commented ×2

Error Message

Traceback (most recent call last): File "/__w/pytorch/pytorch/test/functorch/test_eager_transforms.py", line 5315, in test_vmap_grad_sum gx = vmap(grad(sum_pyop), (0, None))(x, 0) File "/opt/conda/envs/py_3.14/lib/python3.14/site-packages/torch/_functorch/apis.py", line 220, in wrapped return vmap_impl( # pyrefly: ignore[bad-argument-type] ...<6 lines>... **kwargs, ) File "/opt/conda/envs/py_3.14/lib/python3.14/site-packages/torch/_functorch/vmap.py", line 316, in vmap_impl return _flat_vmap( func, ...<6 lines>... **kwargs, ) File "/opt/conda/envs/py_3.14/lib/python3.14/site-packages/torch/_functorch/vmap.py", line 507, in _flat_vmap batched_outputs = func(*batched_inputs, **kwargs) File "/opt/conda/envs/py_3.14/lib/python3.14/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.14/site-packages/torch/_functorch/eager_transforms.py", line 1535, in grad_impl results = grad_and_value_impl(func, argnums, has_aux, args, kwargs) File "/opt/conda/envs/py_3.14/lib/python3.14/site-packages/torch/_functorch/vmap.py", line 56, in fn return f(*args, **kwargs) File "/opt/conda/envs/py_3.14/lib/python3.14/site-packages/torch/_functorch/eager_transforms.py", line 1486, in grad_and_value_impl output = func(*args, **kwargs) File "/__w/pytorch/pytorch/test/functorch/test_eager_transforms.py", line 5222, in call return super().call(*args, **kwargs) ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^ File "/opt/conda/envs/py_3.14/lib/python3.14/site-packages/torch/_ops.py", line 539, in call return self.dispatch(dispatch_key_set.highestPriorityTypeId(), *args, **kwargs) ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/conda/envs/py_3.14/lib/python3.14/site-packages/torch/_ops.py", line 507, in dispatch final_key = resolve_key(self, dispatch_key) File "/opt/conda/envs/py_3.14/lib/python3.14/site-packages/torch/_ops.py", line 261, in resolve_key raise NotImplementedError(f"could not find kernel for {op} at dispatch key {k}") NotImplementedError: could not find kernel for mysum at dispatch key DispatchKey.CPU

To execute this test, run the following from the base repo dir: PYTORCH_TEST_WITH_DYNAMO=1 python test/functorch/test_eager_transforms.py TestHigherOrderOperatorInteractionCPU.test_vmap_grad_sum_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.

Fix Action

Fix / Workaround

Traceback (most recent call last):
  File "/__w/pytorch/pytorch/test/functorch/test_eager_transforms.py", line 5315, in test_vmap_grad_sum
    gx = vmap(grad(sum_pyop), (0, None))(x, 0)
  File "/opt/conda/envs/py_3.14/lib/python3.14/site-packages/torch/_functorch/apis.py", line 220, in wrapped
    return vmap_impl(
        # pyrefly: ignore[bad-argument-type]
    ...<6 lines>...
        **kwargs,
    )
  File "/opt/conda/envs/py_3.14/lib/python3.14/site-packages/torch/_functorch/vmap.py", line 316, in vmap_impl
    return _flat_vmap(
        func,
    ...<6 lines>...
        **kwargs,
    )
  File "/opt/conda/envs/py_3.14/lib/python3.14/site-packages/torch/_functorch/vmap.py", line 507, in _flat_vmap
    batched_outputs = func(*batched_inputs, **kwargs)
  File "/opt/conda/envs/py_3.14/lib/python3.14/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.14/site-packages/torch/_functorch/eager_transforms.py", line 1535, in grad_impl
    results = grad_and_value_impl(func, argnums, has_aux, args, kwargs)
  File "/opt/conda/envs/py_3.14/lib/python3.14/site-packages/torch/_functorch/vmap.py", line 56, in fn
    return f(*args, **kwargs)
  File "/opt/conda/envs/py_3.14/lib/python3.14/site-packages/torch/_functorch/eager_transforms.py", line 1486, in grad_and_value_impl
    output = func(*args, **kwargs)
  File "/__w/pytorch/pytorch/test/functorch/test_eager_transforms.py", line 5222, in __call__
    return super().__call__(*args, **kwargs)
           ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
  File "/opt/conda/envs/py_3.14/lib/python3.14/site-packages/torch/_ops.py", line 539, in __call__
    return self.dispatch(dispatch_key_set.highestPriorityTypeId(), *args, **kwargs)
           ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/envs/py_3.14/lib/python3.14/site-packages/torch/_ops.py", line 507, in dispatch
    final_key = resolve_key(self, dispatch_key)
  File "/opt/conda/envs/py_3.14/lib/python3.14/site-packages/torch/_ops.py", line 261, in resolve_key
    raise NotImplementedError(f"could not find kernel for {op} at dispatch key {k}")
NotImplementedError: could not find kernel for mysum at dispatch key DispatchKey.CPU

Code Example

Traceback (most recent call last):
  File "/__w/pytorch/pytorch/test/functorch/test_eager_transforms.py", line 5315, in test_vmap_grad_sum
    gx = vmap(grad(sum_pyop), (0, None))(x, 0)
  File "/opt/conda/envs/py_3.14/lib/python3.14/site-packages/torch/_functorch/apis.py", line 220, in wrapped
    return vmap_impl(
        # pyrefly: ignore[bad-argument-type]
    ...<6 lines>...
        **kwargs,
    )
  File "/opt/conda/envs/py_3.14/lib/python3.14/site-packages/torch/_functorch/vmap.py", line 316, in vmap_impl
    return _flat_vmap(
        func,
    ...<6 lines>...
        **kwargs,
    )
  File "/opt/conda/envs/py_3.14/lib/python3.14/site-packages/torch/_functorch/vmap.py", line 507, in _flat_vmap
    batched_outputs = func(*batched_inputs, **kwargs)
  File "/opt/conda/envs/py_3.14/lib/python3.14/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.14/site-packages/torch/_functorch/eager_transforms.py", line 1535, in grad_impl
    results = grad_and_value_impl(func, argnums, has_aux, args, kwargs)
  File "/opt/conda/envs/py_3.14/lib/python3.14/site-packages/torch/_functorch/vmap.py", line 56, in fn
    return f(*args, **kwargs)
  File "/opt/conda/envs/py_3.14/lib/python3.14/site-packages/torch/_functorch/eager_transforms.py", line 1486, in grad_and_value_impl
    output = func(*args, **kwargs)
  File "/__w/pytorch/pytorch/test/functorch/test_eager_transforms.py", line 5222, in __call__
    return super().__call__(*args, **kwargs)
           ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
  File "/opt/conda/envs/py_3.14/lib/python3.14/site-packages/torch/_ops.py", line 539, in __call__
    return self.dispatch(dispatch_key_set.highestPriorityTypeId(), *args, **kwargs)
           ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/envs/py_3.14/lib/python3.14/site-packages/torch/_ops.py", line 507, in dispatch
    final_key = resolve_key(self, dispatch_key)
  File "/opt/conda/envs/py_3.14/lib/python3.14/site-packages/torch/_ops.py", line 261, in resolve_key
    raise NotImplementedError(f"could not find kernel for {op} at dispatch key {k}")
NotImplementedError: could not find kernel for mysum at dispatch key DispatchKey.CPU

To execute this test, run the following from the base repo dir:
    PYTORCH_TEST_WITH_DYNAMO=1 python test/functorch/test_eager_transforms.py TestHigherOrderOperatorInteractionCPU.test_vmap_grad_sum_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 3 workflow(s) with 3 failures and 3 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_vmap_grad_sum_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>
Traceback (most recent call last):
  File "/__w/pytorch/pytorch/test/functorch/test_eager_transforms.py", line 5315, in test_vmap_grad_sum
    gx = vmap(grad(sum_pyop), (0, None))(x, 0)
  File "/opt/conda/envs/py_3.14/lib/python3.14/site-packages/torch/_functorch/apis.py", line 220, in wrapped
    return vmap_impl(
        # pyrefly: ignore[bad-argument-type]
    ...<6 lines>...
        **kwargs,
    )
  File "/opt/conda/envs/py_3.14/lib/python3.14/site-packages/torch/_functorch/vmap.py", line 316, in vmap_impl
    return _flat_vmap(
        func,
    ...<6 lines>...
        **kwargs,
    )
  File "/opt/conda/envs/py_3.14/lib/python3.14/site-packages/torch/_functorch/vmap.py", line 507, in _flat_vmap
    batched_outputs = func(*batched_inputs, **kwargs)
  File "/opt/conda/envs/py_3.14/lib/python3.14/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.14/site-packages/torch/_functorch/eager_transforms.py", line 1535, in grad_impl
    results = grad_and_value_impl(func, argnums, has_aux, args, kwargs)
  File "/opt/conda/envs/py_3.14/lib/python3.14/site-packages/torch/_functorch/vmap.py", line 56, in fn
    return f(*args, **kwargs)
  File "/opt/conda/envs/py_3.14/lib/python3.14/site-packages/torch/_functorch/eager_transforms.py", line 1486, in grad_and_value_impl
    output = func(*args, **kwargs)
  File "/__w/pytorch/pytorch/test/functorch/test_eager_transforms.py", line 5222, in __call__
    return super().__call__(*args, **kwargs)
           ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
  File "/opt/conda/envs/py_3.14/lib/python3.14/site-packages/torch/_ops.py", line 539, in __call__
    return self.dispatch(dispatch_key_set.highestPriorityTypeId(), *args, **kwargs)
           ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/envs/py_3.14/lib/python3.14/site-packages/torch/_ops.py", line 507, in dispatch
    final_key = resolve_key(self, dispatch_key)
  File "/opt/conda/envs/py_3.14/lib/python3.14/site-packages/torch/_ops.py", line 261, in resolve_key
    raise NotImplementedError(f"could not find kernel for {op} at dispatch key {k}")
NotImplementedError: could not find kernel for mysum at dispatch key DispatchKey.CPU

To execute this test, run the following from the base repo dir:
    PYTORCH_TEST_WITH_DYNAMO=1 python test/functorch/test_eager_transforms.py TestHigherOrderOperatorInteractionCPU.test_vmap_grad_sum_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_vmap_grad_sum_cpu is failing due to a NotImplementedError exception, indicating a missing kernel for the mysum operation on CPU.

Guidance

  • Investigate the NotImplementedError exception and the missing kernel for mysum on CPU.
  • Review the test file functorch/test_eager_transforms.py and the related code to understand the context of the error.
  • Check the PyTorch documentation and issues to see if there are any known problems or solutions related to the mysum operation on CPU.
  • Consider running the test with the PYTORCH_TEST_WITH_DYNAMO=1 environment variable to see if it provides more information about the issue.

Example

No specific code example is provided, as the issue is related to a missing kernel implementation.

Notes

The error message suggests that the mysum operation is not implemented for CPU, which might be a limitation of the current PyTorch version or a missing feature.

Recommendation

Apply workaround: Investigate alternative implementations or workarounds for the mysum operation on CPU, such as using a different operation or implementing a custom kernel.

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

pytorch - 💡(How to fix) Fix DISABLED test_vmap_grad_sum_cpu (__main__.TestHigherOrderOperatorInteractionCPU) [2 comments, 2 participants]