Function value_and_grad

Source
pub fn value_and_grad<'a, F, Err>(
    f: F,
) -> impl FnMut(&[Array]) -> Result<(Vec<Array>, Vec<Array>)> + 'a
where F: IntoValueAndGrad<'a, Err> + 'a,
Expand description

Returns a function which computes the value and gradient of f with a default argument number &[0].

See also [value_and_grad_with_arg_nums] for a version that allows specifying the argument numbers