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

Const sows dropped in transformations #75

Open
jkramar opened this issue Apr 30, 2024 · 0 comments
Open

Const sows dropped in transformations #75

jkramar opened this issue Apr 30, 2024 · 0 comments

Comments

@jkramar
Copy link

jkramar commented Apr 30, 2024

Here's an example:

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant