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 inplace for slicing views of tensors #1454

Open
t-vi opened this issue Nov 19, 2024 · 1 comment
Open

Support inplace for slicing views of tensors #1454

t-vi opened this issue Nov 19, 2024 · 1 comment
Labels
in-place program-coverage Requests for model and program coverage

Comments

@t-vi
Copy link
Collaborator

t-vi commented Nov 19, 2024

import torch, thunder
def fn(t):
    return t[2].sin_() * 2

jfn = thunder.jit(fn)
jfn(torch.randn(10))

gets me

NotImplementedError: in-place op of `torch.sin_` to `<TensorProxy(name="x", dtype=thunder.dtypes.float32, shape=())>`, a view tensor of `<TensorProxy(name="t", dtype=thunder.dtypes.float32, shape=(10,))>` is not supported because 1 != 10
@t-vi t-vi added program-coverage Requests for model and program coverage in-place labels Nov 19, 2024
@IvanYashchuk IvanYashchuk changed the title support inplace for sub-tensors Support inplace for slicing views of tensors Nov 19, 2024
@IvanYashchuk
Copy link
Collaborator

In the past, you mentioned that some HuggingFace model implementations do similar slicing and inplace updates. Can you provide references to the code where it happens?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in-place program-coverage Requests for model and program coverage
Projects
None yet
Development

No branches or pull requests

2 participants