mlx_rs::transforms

Trait IntoKeyedValueAndGrad

Source
pub trait IntoKeyedValueAndGrad<'a, Arr, Args, Err>
where Arr: AsRef<Array>, Args: Clone,
{ // Required method fn into_keyed_value_and_grad( self, ) -> impl FnMut(KeyedParameters<Arr>, Args) -> Result<(Vec<Array>, KeyedGrad)> + 'a; }
Expand description

Similar to [IntoValueAndGrad] but for functions that take a hashmap of parameters.

Required Methods§

Source

fn into_keyed_value_and_grad( self, ) -> impl FnMut(KeyedParameters<Arr>, Args) -> Result<(Vec<Array>, KeyedGrad)> + '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", so this trait is not object safe.

Implementors§

Source§

impl<'a, F, Arr, Args> IntoKeyedValueAndGrad<'a, Arr, Args, ()> for F
where F: FnMut(HashMap<Rc<str>, Array>, Args) -> Vec<Array> + 'a, Arr: AsRef<Array>, Args: Clone,

Source§

impl<'a, F, Arr, Args> IntoKeyedValueAndGrad<'a, Arr, Args, Exception> for F
where F: FnMut(HashMap<Rc<str>, Array>, Args) -> Result<Vec<Array>> + 'a, Arr: AsRef<Array>, Args: Clone,