Skip to content

Is there a prototypical way to disable optional jax.numpy usage? #24087

Answered by dfm
marius311 asked this question in Q&A
Discussion options

You must be logged in to vote

I'm not sure that this is such a common (or recommended!) pattern, but I could imagine it working in some cases. We typically recommend importing jax.numpy as jnp because jnp and np are often both used in JAX code, and the programming models are different enough that it seems somewhat unlikely that you'd be able to write performant code the way you suggest. But, like I said, I certainly believe you that there are cases where this works and is useful! I'd say that the best approach for your specific question will depend on the details of your project.

As an aside: JAX, numpy, and some other array libraries now have support for the Array API standard, so it might be worth looking into using…

Replies: 1 comment 1 reply

Comment options

dfm
Oct 3, 2024
Collaborator

You must be logged in to vote
1 reply
@marius311
Comment options

Answer selected by marius311
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants