pub struct MlxClosureCustom(/* private fields */);Expand description
Owned MLX custom-transform (VJP) closure, released exactly once.
Implementations§
Source§impl MlxClosureCustom
impl MlxClosureCustom
Sourcepub fn from_fn<F>(callback: F) -> Result<Self, MlxCError>
pub fn from_fn<F>(callback: F) -> Result<Self, MlxCError>
Builds an owned custom-transform closure from a Rust callable that receives inputs, outputs, and upstream gradients.
Sourcepub fn set(&mut self, source: &Self) -> Result<(), MlxCError>
pub fn set(&mut self, source: &Self) -> Result<(), MlxCError>
Copies the source closure handle into this handle.
Sourcepub fn apply(
&self,
inputs: &MlxArrayVector,
outputs: &MlxArrayVector,
upstream_gradients: &MlxArrayVector,
) -> Result<MlxArrayVector, MlxCError>
pub fn apply( &self, inputs: &MlxArrayVector, outputs: &MlxArrayVector, upstream_gradients: &MlxArrayVector, ) -> Result<MlxArrayVector, MlxCError>
Applies the custom transform.
§Errors
Returns the captured MLX-C description when application fails.
Trait Implementations§
Source§impl Debug for MlxClosureCustom
impl Debug for MlxClosureCustom
Source§impl Drop for MlxClosureCustom
impl Drop for MlxClosureCustom
Auto Trait Implementations§
impl !Send for MlxClosureCustom
impl !Sync for MlxClosureCustom
impl Freeze for MlxClosureCustom
impl RefUnwindSafe for MlxClosureCustom
impl Unpin for MlxClosureCustom
impl UnsafeUnpin for MlxClosureCustom
impl UnwindSafe for MlxClosureCustom
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more