Applier

Struct Applier 

Source
pub struct Applier<B: Backend> { /* private fields */ }
Expand description

Applier that applies tensor snapshots to module parameters with proper adapter support using container type information

Implementations§

Source§

impl<B: Backend> Applier<B>

Source

pub fn new( views: Vec<TensorSnapshot>, filter: Option<PathFilter>, adapter: Option<Box<dyn ModuleAdapter>>, skip_enum_variants: bool, ) -> Self

Create a new applier with snapshots, optional filter, and optional adapter

§Arguments
  • views - A vector of TensorSnapshot objects to apply
  • filter - An optional PathFilter to determine which tensors to apply. When None, all available tensors are applied.
  • adapter - Optional adapter to transform tensors based on container types
  • skip_enum_variants - Skip enum variant names when matching paths
Source

pub fn into_result(self) -> ApplyResult

Convert the applier into a result

Trait Implementations§

Source§

impl<B: Backend> ModuleMapper<B> for Applier<B>

Source§

fn enter_module(&mut self, name: &str, container_type: &str)

Called when entering a submodule. Read more
Source§

fn exit_module(&mut self, _name: &str, container_type: &str)

Called when exiting a submodule. Read more
Source§

fn map_float<const D: usize>( &mut self, param: Param<Tensor<B, D>>, ) -> Param<Tensor<B, D>>

Map a float parameter in the module. Read more
Source§

fn map_int<const D: usize>( &mut self, param: Param<Tensor<B, D, Int>>, ) -> Param<Tensor<B, D, Int>>

Map an int parameter in the module. Read more
Source§

fn map_bool<const D: usize>( &mut self, param: Param<Tensor<B, D, Bool>>, ) -> Param<Tensor<B, D, Bool>>

Map a bool parameter in the module. Read more

Auto Trait Implementations§

§

impl<B> Freeze for Applier<B>

§

impl<B> !RefUnwindSafe for Applier<B>

§

impl<B> !Send for Applier<B>

§

impl<B> !Sync for Applier<B>

§

impl<B> Unpin for Applier<B>
where B: Unpin,

§

impl<B> !UnwindSafe for Applier<B>

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> 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> Same for T

Source§

type Output = T

Should always be Self
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V