Add ODERNN layer for ODE-RNN/ODE-LSTM architectures#995
Open
ChrisRackauckas-Claude wants to merge 1 commit into
Open
Add ODERNN layer for ODE-RNN/ODE-LSTM architectures#995ChrisRackauckas-Claude wants to merge 1 commit into
ChrisRackauckas-Claude wants to merge 1 commit into
Conversation
Implements the ODERNN layer that combines a Neural ODE for continuous hidden state dynamics with a recurrent neural network cell (LSTM/GRU/RNN) for processing sequential observations. This implements a variant of the ODE-RNN/ODE-LSTM architecture from: - Rubanova et al. "Latent ODEs for Irregularly-Sampled Time Series" (2019) - Lechner & Hasani "Learning Long-Term Dependencies in Irregularly-Sampled Time Series" (2020) The implementation follows the efficient approach suggested by @ChrisRackauckas: - Solve the ODE once from first to last time point with saveat=ts - Use the ODE solutions at each time point as continuous hidden states - The RNN cell then processes inputs using these ODE-evolved states Features: - Works with any Lux recurrent cell (LSTMCell, GRUCell, RNNCell) - Supports both return_sequence=true (all outputs) and return_sequence=false (final only) - Uses InterpolatingAdjoint with ZygoteVJP for efficient gradient computation - Fully differentiable loop implementation using foldl Closes SciML#422 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements the
ODERNNlayer that combines a Neural ODE for continuous hidden state dynamics with a recurrent neural network cell (LSTM/GRU/RNN) for processing sequential observations.This implements a variant of the ODE-RNN/ODE-LSTM architecture from:
Key implementation details:
saveat=ts, then use the ODE solutions at each time point as continuous hidden statesfoldlfor a fully differentiable loop implementation (avoids mutation issues with Zygote)LSTMCell,GRUCell,RNNCell)return_sequence=true(all outputs) andreturn_sequence=false(final only)InterpolatingAdjointwithZygoteVJPfor efficient gradient computationExample usage:
Closes #422
cc @ChrisRackauckas @MartinuzziFrancesco
Test plan
return_sequence=trueandreturn_sequence=false🤖 Generated with Claude Code