Skip to content

Is the full set of possible types which could be arguments to JAX primitives available somewhere? #16634

Answered by jakevdp
davisyoshida asked this question in Q&A
Discussion options

You must be logged in to vote

JAX makes frequent use of duck typing, so there is no single base class for all types that can be used in place of arrays.

If you're interested in checking if a particular value is a valid jax array argument, you can use isinstance(x, jax.Array). The jax.Array class is an abstract base class that has its __instancecheck__ overridden to return the right thing.

I would avoid trying to enumerate things like Token,Ref, etc. as these are considered internal implementation details that may change from release to release. If there's any operation that you cannot do via the public API, please open a bug with the details.

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@davisyoshida
Comment options

@davisyoshida
Comment options

@jakevdp
Comment options

@davisyoshida
Comment options

Answer selected by davisyoshida
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