-
Hi! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 11 replies
-
In general, you cannot jit-compile code with control flow that depends on the value in an array. It's possible to use structured control flow primitives in this case, but this sort of loop-based construction will generally be much less efficient than array-based primitives, particularly on GPU or TPU. For code like yours, it would likely be best to write your code using broadcasting and jnp.where:
|
Beta Was this translation helpful? Give feedback.
-
What is It looks like you can replace this block
with
which will generally be much more efficient, and will have no issue with compilation. |
Beta Was this translation helpful? Give feedback.
What is
x=0
meant to do within your loop? It looks like a no-op, because the variable is never used.It looks like you can replace this block
with
which will generally be much more efficient, and will have no issue with compilation.