Skip to content
Discussion options

You must be logged in to vote

The inner is already cached right?

The inner function is the return value of func_generator, so when you JIT-compile that return value you are JIT-compiling (and cacheing) inner. Does that make sense?

I used jit outside a big for-loop, and each iteration I call func_generator

If you have everything under an outer JIT, then the relevant JIT cache / compilation is for that outer-jit function. Each inner function call will be inlined into the jaxpr of that outer function, and that will be compiled once. There will not be any cache for functions created within a JIT-compiled function.

In general there is no issue with this approach, but keep in mind that if you wrap a for loop in jit, that

Replies: 4 comments 3 replies

Comment options

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

Comment options

You must be logged in to vote
0 replies
Comment options

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

Comment options

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

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