Skip to content
Discussion options

You must be logged in to vote

Hi - thanks for the question!

I think the definition of "dynamic" here is what is causing confusion. The issue of dynamic vs. static is not about whether a variable is changing during the program, but rather centers around what can be known by JAX at trace time. When you write a loop (like for i in range(5)), the value of i is known statically at trace-time.

However, the result of a jax operation (like jnp.maximum) is not evaluated at trace-time, even if its inputs are static. The output of the function is dynamic, and since JAX arrays must be statically shaped, you cannot create an array with a size that comes from the result of a jax function like jnp.maximum.

Does that answer your ques…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@riven314
Comment options

@jakevdp
Comment options

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