Skip to content
Discussion options

You must be logged in to vote

Thanks for the question! The full answer is a bit more involved, but in general recompilation is triggered by changes in the static properties of input arrays. So if a JIT-compiled function sees an input with the same shape and dtype as one it has seen before, the cached code is used. If the function sees an input with a shape and/or dtype it has not seen before, this triggers a re-compilation. With this in mind, the recompilations you're seeing are exactly as expected.

Why is this? Mainly, it's due to the way XLA compilation works: programs are compiled for inputs of a particular shape. There has been some amount of work on supporting dynamic shapes in XLA & in JAX, but it hasn't quite m…

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
0 replies
Comment options

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

cgarciae Nov 4, 2021
Collaborator

@mohamad-amin
Comment options

@jakevdp
Comment options

@mohamad-amin
Comment options

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