pub struct ReverseAD<F: IntegrateFloat> { /* private fields */ }Expand description
Reverse mode automatic differentiation engine
Implementations§
Source§impl<F: IntegrateFloat> ReverseAD<F>
impl<F: IntegrateFloat> ReverseAD<F>
Sourcepub fn with_checkpoint_strategy(self, strategy: CheckpointStrategy) -> Self
pub fn with_checkpoint_strategy(self, strategy: CheckpointStrategy) -> Self
Set checkpointing strategy
Sourcepub fn gradient<Func>(
&mut self,
f: Func,
x: ArrayView1<'_, F>,
) -> IntegrateResult<Array1<F>>
pub fn gradient<Func>( &mut self, f: Func, x: ArrayView1<'_, F>, ) -> IntegrateResult<Array1<F>>
Compute gradient using reverse mode AD
Sourcepub fn jacobian<Func>(
&mut self,
f: Func,
x: ArrayView1<'_, F>,
) -> IntegrateResult<Array2<F>>
pub fn jacobian<Func>( &mut self, f: Func, x: ArrayView1<'_, F>, ) -> IntegrateResult<Array2<F>>
Compute Jacobian using reverse mode AD
Sourcepub fn hessian<Func>(
&mut self,
f: Func,
x: ArrayView1<'_, F>,
) -> IntegrateResult<Array2<F>>
pub fn hessian<Func>( &mut self, f: Func, x: ArrayView1<'_, F>, ) -> IntegrateResult<Array2<F>>
Compute Hessian (second derivatives) using reverse-over-forward AD
Sourcepub fn batch_gradient<Func>(
&mut self,
f: Func,
x_batch: &[Array1<F>],
) -> IntegrateResult<Vec<Array1<F>>>
pub fn batch_gradient<Func>( &mut self, f: Func, x_batch: &[Array1<F>], ) -> IntegrateResult<Vec<Array1<F>>>
Compute gradients for multiple inputs in batch
Sourcepub fn jvp<Func>(
&mut self,
f: Func,
x: ArrayView1<'_, F>,
v: ArrayView1<'_, F>,
) -> IntegrateResult<Array1<F>>
pub fn jvp<Func>( &mut self, f: Func, x: ArrayView1<'_, F>, v: ArrayView1<'_, F>, ) -> IntegrateResult<Array1<F>>
Compute Jacobian-vector product efficiently without forming full Jacobian
Sourcepub fn vjp<Func>(
&mut self,
f: Func,
x: ArrayView1<'_, F>,
v: ArrayView1<'_, F>,
) -> IntegrateResult<Array1<F>>
pub fn vjp<Func>( &mut self, f: Func, x: ArrayView1<'_, F>, v: ArrayView1<'_, F>, ) -> IntegrateResult<Array1<F>>
Compute vector-Jacobian product (useful for backpropagation)
Auto Trait Implementations§
impl<F> Freeze for ReverseAD<F>
impl<F> RefUnwindSafe for ReverseAD<F>where
F: RefUnwindSafe,
impl<F> Send for ReverseAD<F>where
F: Send,
impl<F> Sync for ReverseAD<F>where
F: Sync,
impl<F> Unpin for ReverseAD<F>where
F: Unpin,
impl<F> UnwindSafe for ReverseAD<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