Lightning-AI / Lightning-AI/lightning-thunder

support unary positive (and systematically check the __ ops?)

Open
#996 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

This gets quite the traceback when it should just map `__pos__` to `torch.Tensor.positive`
```
import thunder, torch
def fn(a):
return +a
jfn = thunder.jit(fn)
inp = torch.randn(5)
jfn(inp)
```

Maybe it would be worthwhile to check the dunder methods (unless we already did and just missed this).

cc @apaz-cli

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 reproducing the shown function with thunder.jit and a torch tensor, then trace unary-operator dispatch for Python's __pos__ operation. The change is done when the example runs by mapping __pos__ to torch.Tensor.positive and the related dunder-operation handling has been checked.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.