How to solve TracerIntegerConversionError? #10873
-
I can run the following code without
|
Beta Was this translation helpful? Give feedback.
Answered by
YouJiacheng
May 28, 2022
Replies: 1 comment 3 replies
-
JAX doesn't support dynamic control flow. (specifically, Tracer doesn't support
|
Beta Was this translation helpful? Give feedback.
3 replies
Answer selected by
lanmao998
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
JAX doesn't support dynamic control flow. (specifically, Tracer doesn't support
__index__
method used byrange(n)
orarr[i]
(fortuple
andlist
) etc.)There are 2 options:
a
as static argument. And usenumpy
instead ofjnp
forN
computation, or usejax.ensure_compile_time_eval
(not recommended).jax.lax.while_loop
instead offor i in range(N)
. see https://jax.readthedocs.io/en/latest/_autosummary/jax.lax.while_loop.html