Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions diffrax/_solution.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import warnings
from typing import Any

import jax
import optimistix as optx
from jaxtyping import Array, Bool, PyTree, Real, Shaped

Expand Down Expand Up @@ -50,8 +49,7 @@ def discrete_terminating_event_occurred(self):


def is_okay(result: RESULTS) -> Bool[Array, ""]:
with jax.ensure_compile_time_eval(): # for the `|` between two `Bool[Array, ""]`.
return is_successful(result) | is_event(result)
return is_successful(result) | is_event(result)


def is_successful(result: RESULTS) -> Bool[Array, ""]:
Expand All @@ -74,8 +72,7 @@ def update_result(old_result: RESULTS, new_result: RESULTS) -> RESULTS:
error_n | error_n error_n error_o
"""
out_result = RESULTS.where(is_okay(old_result), new_result, old_result)
with jax.ensure_compile_time_eval():
pred = is_okay(new_result) & is_event(old_result)
pred = is_okay(new_result) & is_event(old_result)
return RESULTS.where(pred, old_result, out_result)


Expand Down