Lightning-AI / Lightning-AI/lightning-thunder

Support inplace for slicing views of tensors

Open
#1,454 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

in-place program-coverage
Dominant language
Python
Stars
1.5k
Forks
121
PR merge metrics
No merged PRs in 30d

Description

```py
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 ``, a view tensor of `` is not supported because 1 != 10
```

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the provided fn example with thunder.jit and inspect the handling of torch.sin_ on the slicing view t[2]. Trace how the view shape is compared with the base tensor. Done means the example executes without the current NotImplementedError and preserves correct in-place view behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
compilers, machine-learning
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.