mlx_rs::transforms

Trait IntoGrad

Source
pub trait IntoGrad<'a, Args, Output, Err> {
    // Required method
    fn into_grad(
        self,
        argument_numbers: impl IntoOption<&'a [i32]>,
    ) -> impl FnMut(Args) -> Result<Output> + 'a;
}
Expand description

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

Required Methods§

Source

fn into_grad( self, argument_numbers: impl IntoOption<&'a [i32]>, ) -> impl FnMut(Args) -> Result<Output> + 'a

Convert the function/closure into a closure that computes the 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> IntoGrad<'a, &Array, Array, ()> for F
where F: FnMut(&Array) -> Array + 'a,

Source§

impl<'a, F> IntoGrad<'a, &Array, Array, Exception> for F
where F: FnMut(&Array) -> Result<Array> + 'a,

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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