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

Add support for jacrev, jacfwd, hessian, vmap #9

Open
martinjm97 opened this issue Jul 30, 2023 · 3 comments
Open

Add support for jacrev, jacfwd, hessian, vmap #9

martinjm97 opened this issue Jul 30, 2023 · 3 comments

Comments

@martinjm97
Copy link
Contributor

martinjm97 commented Jul 30, 2023

Extending the tests in

print(grads)
with

> x = jax.jacrev(add_one)(jnp.array([1., 2., 3.]), jnp.array([1., 2., 3.]))
NotImplementedError: Batching rule for 'enzyme_rev' not implemented
> x = jax.jacfwd(add_one)(jnp.array([1., 2., 3.]), jnp.array([1., 2., 3.]))
NotImplementedError: Batching rule for 'enzyme_fwd' not implemented
> x = jax.hessian(add_one)(jnp.array([1., 2., 3.]), jnp.array([1., 2., 3.]))
NotImplementedError: Differentiation rule for 'enzyme_aug' not implemented
> x = jax.jit(jax.vmap(lambda x: add_one(x, jnp.array([1., 2., 3.]))))(jnp.array([jnp.array([1., 2., 3.])]*5))
NotImplementedError: Batching rule for 'enzyme_primal' not implemented
@martinjm97 martinjm97 changed the title Add support for jacrev and jacfwd Add support for jacrev and jacfwd and hessian Jul 30, 2023
@martinjm97 martinjm97 changed the title Add support for jacrev and jacfwd and hessian Add support for jacrev, jacfwd, hessian, vmap Jul 30, 2023
@croci
Copy link

croci commented Nov 3, 2023

Are jax.grad and jax.value_and_grad already supported?

@martinjm97
Copy link
Contributor Author

Hi @croci,

I believe so. I just tested it by adding:

x = jax.grad(add_one)(.1, .1)
x = jax.value_and_grad(add_one)(1., 2.)

to the end of the test.py file.

--Jesse

@croci
Copy link

croci commented Nov 5, 2023

@martinjm97 ok great! I couldn't get it to work on the pip version, but that is v0.0.4 (and I confess I didn't try too hard). Thanks a lot!

aryavohra added a commit that referenced this issue Nov 12, 2024
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

2 participants