pub struct FiniteDifferenceComputer<F: Float> { /* private fields */ }Expand description
Finite difference gradient computer
Implementations§
Source§impl<F: Float> FiniteDifferenceComputer<F>
impl<F: Float> FiniteDifferenceComputer<F>
Sourcepub fn with_config(config: FiniteDifferenceConfig) -> Self
pub fn with_config(config: FiniteDifferenceConfig) -> Self
Create with custom configuration
Sourcepub fn compute_gradient<'a, Func>(
&self,
function: Func,
input: &Tensor<'a, F>,
) -> Result<Tensor<'a, F>, StabilityError>
pub fn compute_gradient<'a, Func>( &self, function: Func, input: &Tensor<'a, F>, ) -> Result<Tensor<'a, F>, StabilityError>
Compute finite difference approximation of gradient
Sourcepub fn compute_hessian<'a, Func>(
&self,
function: Func,
input: &Tensor<'a, F>,
) -> Result<Array<F, IxDyn>, StabilityError>
pub fn compute_hessian<'a, Func>( &self, function: Func, input: &Tensor<'a, F>, ) -> Result<Array<F, IxDyn>, StabilityError>
Compute second-order derivatives (Hessian approximation)
Trait Implementations§
Auto Trait Implementations§
impl<F> Freeze for FiniteDifferenceComputer<F>
impl<F> RefUnwindSafe for FiniteDifferenceComputer<F>where
F: RefUnwindSafe,
impl<F> Send for FiniteDifferenceComputer<F>
impl<F> Sync for FiniteDifferenceComputer<F>
impl<F> Unpin for FiniteDifferenceComputer<F>where
F: Unpin,
impl<F> UnsafeUnpin for FiniteDifferenceComputer<F>
impl<F> UnwindSafe for FiniteDifferenceComputer<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