-
I have little clue on what is going wrong, so would like to put it here for advice: I have a function (lets call it
But once I made the change in
The error is as follows:
In both function, |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
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 However, the result of a jax operation (like Does that answer your question? |
Beta Was this translation helpful? Give feedback.
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 ofi
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 likejnp.maximum
.Does that answer your ques…