Skip to content

Commit

Permalink
Stackless yashful
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 681582933
  • Loading branch information
dougalm authored and learned_optimization authors committed Oct 4, 2024
1 parent 36fd2e1 commit c9572a1
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions learned_optimization/jax_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,12 @@ def body_fn(_, operand):

def in_jit() -> bool:
"""Returns true if tracing jit."""
return "DynamicJaxprTrace" in str(
jax.core.thread_local_state.trace_state.trace_stack
)
if jax.__version_info__ <= (0, 4, 33):
return "DynamicJaxprTrace" in str(
jax.core.thread_local_state.trace_state.trace_stack # type: ignore
)

return jax.core.unsafe_am_i_under_a_jit_DO_NOT_USE()


Carry = TypeVar("Carry")
Expand Down

0 comments on commit c9572a1

Please sign in to comment.