Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Const sows dropped in transformations #75

@jkramar

Description

@jkramar

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions