Lightning-AI / Lightning-AI/lightning-thunder

[feature request] Indexing with boolean masks

Open
#126 0 comments 0 reactions 0 assignees View on GitHub
enhancement help wanted operators
Dominant language
Python
Stars
1.5k
Forks
121
PR merge metrics
No merged PRs in 30d

Description

## 🚀 Feature

No indexing with boolean mask, for example:

```python
import torch; import thunder
m = x <= 0.5

def f(x, m):
return x[m]


jf = thunder.jit(f)
jf(x, m)
```

fails with
```
RuntimeError: Advanced indexing currently only supports zero or one-dimensional integer tensors, but found a tensor with dtype bool8 and 1 dimensions

```

cc @apaz-cli

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by running the provided Python reproducer with PyTorch and Thunder, then trace the advanced-indexing path that raises the boolean-tensor error. Done means the jitted function accepts x[m] when m is a boolean mask and no longer raises this runtime error.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
compilers
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 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.