pytorch - 💡(How to fix) Fix future annotations break torch.library.triton_op

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

Also, this error is difficult to diagnose, because there is a try-finally that just swallows the following:

Root Cause

Also, this error is difficult to diagnose, because there is a try-finally that just swallows the following: "NameError: name 'torch' is not defined". Would love it for this one to be fixed too.

Code Example

from __future__ import annotations

from torch.library import triton_op


def register():
    import torch

    @triton_op("repro::bad", mutates_args=())
    def bad(x: torch.Tensor) -> torch.Tensor:
        return x

register()
RAW_BUFFERClick to expand / collapse

repro:

from __future__ import annotations

from torch.library import triton_op


def register():
    import torch

    @triton_op("repro::bad", mutates_args=())
    def bad(x: torch.Tensor) -> torch.Tensor:
        return x

register()

ValueError: infer_schema(func): Unsupported type annotation torch.Tensor. It is not a type. Got func with signature (x: 'torch.Tensor') -> 'torch.Tensor')

Also, this error is difficult to diagnose, because there is a try-finally that just swallows the following: "NameError: name 'torch' is not defined". Would love it for this one to be fixed too.

meta-internal context

cc @lolpack @maggiemoss @ndmitchell @kinto0 @samwgoldman @anjali411 @chauhang @penguinwu @bdhirsh @bobrenjc93 @aorenste

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 future annotations break torch.library.triton_op