pub struct NeuralOde<F: OdeFunc> { /* private fields */ }Expand description
A Neural ODE layer that wraps an OdeFunc with fixed integration limits.
The forward pass integrates y(t0) = y0 to y(t1) and the adjoint
method computes dL/dy0 and dL/dθ via the adjoint sensitivity method
without storing all intermediate activations.
Implementations§
Source§impl<F: OdeFunc> NeuralOde<F>
impl<F: OdeFunc> NeuralOde<F>
Sourcepub fn new(func: F, t0: f64, t1: f64) -> Self
pub fn new(func: F, t0: f64, t1: f64) -> Self
Create a new NeuralOde with default solver configuration.
Sourcepub fn with_config(func: F, t0: f64, t1: f64, config: OdeSolverConfig) -> Self
pub fn with_config(func: F, t0: f64, t1: f64, config: OdeSolverConfig) -> Self
Create a new NeuralOde with a custom solver configuration.
Sourcepub fn forward(
&self,
y0: &[f64],
params: &[f64],
) -> Result<OdeSolution, OdeError>
pub fn forward( &self, y0: &[f64], params: &[f64], ) -> Result<OdeSolution, OdeError>
Forward pass: integrate y0 from t0 to t1.
Uses the adaptive DOPRI5 solver internally.
Sourcepub fn adjoint(
&self,
y0: &[f64],
params: &[f64],
grad_output: &[f64],
) -> Result<AdjointResult, OdeError>
pub fn adjoint( &self, y0: &[f64], params: &[f64], grad_output: &[f64], ) -> Result<AdjointResult, OdeError>
Full adjoint sensitivity method.
Integrates forward to obtain y(t1), then runs the augmented backward
ODE to compute dL/dy0 and dL/dθ in a single backward pass.
§Arguments
y0– initial state.params– ODE parameters.grad_output– upstream gradientdL/dy(t1).
Auto Trait Implementations§
impl<F> Freeze for NeuralOde<F>where
F: Freeze,
impl<F> RefUnwindSafe for NeuralOde<F>where
F: RefUnwindSafe,
impl<F> Send for NeuralOde<F>
impl<F> Sync for NeuralOde<F>
impl<F> Unpin for NeuralOde<F>where
F: Unpin,
impl<F> UnsafeUnpin for NeuralOde<F>where
F: UnsafeUnpin,
impl<F> UnwindSafe for NeuralOde<F>where
F: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more