Skip to content
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

Support auto_functionalized for None returns #125044

Open
zou3519 opened this issue Apr 26, 2024 · 0 comments
Open

Support auto_functionalized for None returns #125044

zou3519 opened this issue Apr 26, 2024 · 0 comments
Labels
actionable module: custom-operators module: pt2-dispatcher PT2 dispatcher-related issues (e.g., aotdispatch, functionalization, faketensor, custom-op, oncall: pt2 triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module

Comments

@zou3519
Copy link
Contributor

zou3519 commented Apr 26, 2024

We support () returns but not None returns:

import torch

lib = torch.library.Library("mylib", "FRAGMENT")
# Change None to "()" and it will pass
lib.define("foo2(Tensor x, Tensor(a!) out) -> None")

def foo_impl(x, out):
    out.copy_(x)

lib.impl("foo", foo_impl, "CompositeExplicitAutograd")

x = torch.randn(3)
out = torch.zeros(3)

@torch.compile
def f(x, out):
    torch.ops.mylib.foo(x, out)

f(x, out)

cc @ezyang @msaroufim @bdhirsh @anijain2305 @chauhang

@zou3519 zou3519 added module: custom-operators module: pt2-dispatcher PT2 dispatcher-related issues (e.g., aotdispatch, functionalization, faketensor, custom-op, oncall: pt2 actionable labels Apr 26, 2024
@jbschlosser jbschlosser added the triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module label Apr 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
actionable module: custom-operators module: pt2-dispatcher PT2 dispatcher-related issues (e.g., aotdispatch, functionalization, faketensor, custom-op, oncall: pt2 triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module
Projects
None yet
Development

No branches or pull requests

2 participants