mlx_rs::utils

Trait Updatable

Source
pub trait Updatable {
    // Required methods
    fn updatable_states(&self) -> impl IntoIterator<Item = &Array>;
    fn updatable_states_mut(&mut self) -> impl IntoIterator<Item = &mut Array>;
}
Expand description

Helper trait for compiling a function that takes a Module and/or an Optimizer. The implementation must ensure consistent ordering of the returned states.

This is automatically implemented for all types that implement ModuleParameters.

Required Methods§

Source

fn updatable_states(&self) -> impl IntoIterator<Item = &Array>

Returns a list of references to the updatable states.

The order of the states should be consistent across calls and should be the same as the order of the states returned by Updatable::updatable_states_mut.

Source

fn updatable_states_mut(&mut self) -> impl IntoIterator<Item = &mut Array>

Returns a list of mutable references to the updatable states.

The order of the states should be consistent across calls and should be the same as the order of the states returned by Updatable::updatable_states.

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.

Implementations on Foreign Types§

Source§

impl<T1, T2> Updatable for (T1, T2)
where T1: Updatable, T2: Updatable,

Source§

fn updatable_states(&self) -> impl IntoIterator<Item = &Array>

Source§

fn updatable_states_mut(&mut self) -> impl IntoIterator<Item = &mut Array>

Implementors§