Skip to content

How to vectorize functions of a custom pytree? #10797

Answered by jakevdp
langmore asked this question in General
Discussion options

You must be logged in to vote

You should call it like this:

vec_dsdt = jax.vmap(dsdt, in_axes=(axes,), out_axes=axes)

in_axes needs to be a tuple (because in general *args for a function is a tuple, even if there is a single arg). This is perhaps slightly unclear because for convenience in the common case, JAX allows passing a single integer in place of a length-1 tuple.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by langmore
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants