Skip to content

using traced array in lax.cond() #17620

Answered by mattjj
LindoNkambule asked this question in Q&A
Discussion options

You must be logged in to vote

Thanks for the question!

If I understand the question correctly, yes that should work. (But also based only on what you said a simple t = jnp.float32(1) if x < 0.5 else jnp.sqrt(jnp.float32(2)/(alpha+lam)) would work too, unless everything is under an outer jit, in which case you'd need a lax.cond again. That's basically what lax.cond is there for: it always works regardless of what tracing/transformations are going on.)

Replies: 1 comment 1 reply

Comment options

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

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