Skip to content

Commit

Permalink
fix #9823
Browse files Browse the repository at this point in the history
  • Loading branch information
mattjj committed Mar 16, 2022
1 parent 4cdc25f commit b0b4dfd
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion jax/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -868,7 +868,8 @@ def f(x):
with jax.ensure_compile_time_eval():
y = jnp.sin(3.0)
z = jnp.sin(y)
if z > 0: # the value of z is availble and can be used in control flow
z_positive = z > 0
if z_positive: # z_positive is usable in Python control flow
return jnp.sin(x)
else:
return jnp.cos(x)
Expand Down

0 comments on commit b0b4dfd

Please sign in to comment.