Const sows dropped in transformations
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 328
- Forks
- 13
- Avg merge
- 49m
- Merged PRs (30d)
- 2
Description
Here's an example:
```py
def f(x):
harvest.sow(0, name='x', tag='tag')
return x
print(harvest.reap(f, tag='tag')(1))
print(harvest.reap(lambda x: jax.remat(f), tag='tag')(1))
print(harvest.reap(lambda x: jax.jit(f), tag='tag')(1))
print(harvest.reap(lambda x: jax.lax.cond(x == 1, f, f, x), tag='tag')(1))
print(
harvest.reap(
lambda x: jax.lax.fori_loop(0, 1, lambda i, xx: f(xx), x), tag='tag'
)(1)
)
print(
harvest.reap(
lambda x: jax.lax.fori_loop(0, x, lambda i, xx: f(xx), x), tag='tag'
)(1)
)
```
The first of these reaps contains `'x': 0`, but the others don't.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Run the Python example using harvest.sow, harvest.reap, and the listed JAX transformations to reproduce the missing constant. Trace how the reaped value is handled through remat, jit, cond, and fori_loop; done means each transformed call preserves the expected 'x': 0 result.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- machine-learning
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100