Skip to content

Adding support for Events to ReversibleAdjoint #601

Description

@jacob-hjortlund

This might be a bit early, considering #593 hasn't been approved as of yet, but I'd like to discuss how to move forward with adding support for Events to the ReversibleAdjoint.

Currently, I am not sure why _loop_reversible_bwd does not support this. As far as I've understood, we'd need to ensure that the backwards pass integrates from t_event back to t_0. When we pass an event, then the current event-handling in loop ensures that reversible_save_index corresponds to the index of t_event.

I think what I'm missing here is that we would need to calculate gradients through the cond_fn of the Event as well, in the case that it depends on y / the parameters of the vector field. Is this correct, or am I on the wrong track here?

Would a path forward be something along the lines of saving the event_mask as part of the residual passed to _loop_reversible_bwd and jax.vjp through the cond_fn at the event to add the gradient contribution from the cond_fn?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions