Skip to main content

IntoValueAndGrad

Trait IntoValueAndGrad 

Source
pub trait IntoValueAndGrad<'a, Err> {
    // Required method
    fn into_value_and_grad(
        self,
        argnums: impl IntoOption<&'a [i32]>,
    ) -> impl FnMut(&[Array]) -> Result<(Vec<Array>, Vec<Array>)> + 'a;
}
Expand description

Trait for functions/closures that can be converted into a closure that computes the value and gradient.

Required Methods§

Source

fn into_value_and_grad( self, argnums: impl IntoOption<&'a [i32]>, ) -> impl FnMut(&[Array]) -> Result<(Vec<Array>, Vec<Array>)> + 'a

Convert the function/closure into a closure that computes the value and gradient.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<'a, F> IntoValueAndGrad<'a, ()> for F
where F: FnMut(&[Array]) -> Vec<Array> + 'a,

Source§

impl<'a, F> IntoValueAndGrad<'a, Exception> for F
where F: FnMut(&[Array]) -> Result<Vec<Array>> + 'a,