mlx_rs::module

Struct Param

Source
pub struct Param<T> {
    pub value: T,
    /* private fields */
}
Expand description

A simple wrapper for a module parameter.

Fields§

§value: T

The value of the parameter.

Implementations§

Source§

impl<T> Param<T>

Source

pub fn new(value: T) -> Self

Create a new Param

Trait Implementations§

Source§

impl<T> AsMut<T> for Param<T>

Source§

fn as_mut(&mut self) -> &mut T

Converts this type into a mutable reference of the (usually inferred) input type.
Source§

impl<T> AsRef<T> for Param<T>

Source§

fn as_ref(&self) -> &T

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<T: Clone> Clone for Param<T>

Source§

fn clone(&self) -> Param<T>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Debug> Debug for Param<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T> Deref for Param<T>

Source§

type Target = T

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<T> DerefMut for Param<T>

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
Source§

impl<T> From<T> for Param<T>

Source§

fn from(inner: T) -> Self

Converts to this type from the input type.
Source§

impl Parameter for Param<Array>

Source§

fn freeze(&mut self, _recursive: bool)

Freeze the parameter.
Source§

fn unfreeze(&mut self, _recursive: bool)

Unfreeze the parameter.
Source§

fn is_frozen(&self) -> Option<bool>

Check if the parameter is frozen. Returns None if the parameter is a module that has no parameters.
Source§

fn as_nested_value<'a>(&self) -> NestedValue<Rc<str>, &Array>

Get the parameter as a nested value.
Source§

fn as_nested_value_mut<'a>(&mut self) -> NestedValue<Rc<str>, &mut Array>

Get the parameter as a mutable nested value.
Source§

fn as_trainable_nested_value<'a>(&self) -> Option<NestedValue<Rc<str>, &Array>>

Get the parameter as a nested value if it is trainable.
Source§

impl Parameter for Param<Option<Array>>

Source§

fn freeze(&mut self, _recursive: bool)

Freeze the parameter.
Source§

fn unfreeze(&mut self, _recursive: bool)

Unfreeze the parameter.
Source§

fn is_frozen(&self) -> Option<bool>

Check if the parameter is frozen. Returns None if the parameter is a module that has no parameters.
Source§

fn as_nested_value(&self) -> NestedValue<Rc<str>, &Array>

Get the parameter as a nested value.
Source§

fn as_nested_value_mut(&mut self) -> NestedValue<Rc<str>, &mut Array>

Get the parameter as a mutable nested value.
Source§

fn as_trainable_nested_value(&self) -> Option<NestedValue<Rc<str>, &Array>>

Get the parameter as a nested value if it is trainable.

Auto Trait Implementations§

§

impl<T> Freeze for Param<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for Param<T>
where T: RefUnwindSafe,

§

impl<T> Send for Param<T>
where T: Send,

§

impl<T> Sync for Param<T>
where T: Sync,

§

impl<T> Unpin for Param<T>
where T: Unpin,

§

impl<T> UnwindSafe for Param<T>
where T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<!> for T

Source§

fn from(t: !) -> T

Converts to this type from the input type.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> IntoOption<T> for T

Source§

fn into_option(self) -> Option<T>

Convert into an Option.
Source§

impl<T> IntoStrideBy for T

Source§

fn stride_by(self, stride: i32) -> StrideBy<T>

Create a stride indexing operation.
Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.