Trait ModuleMapper

pub trait ModuleMapper<B>
where B: Backend,
{ // Provided methods fn enter_module(&mut self, name: &str, container_type: &str) { ... } fn exit_module(&mut self, name: &str, container_type: &str) { ... } fn map_float<const D: usize>( &mut self, param: Param<Tensor<B, D>>, ) -> Param<Tensor<B, D>> { ... } fn map_int<const D: usize>( &mut self, param: Param<Tensor<B, D, Int>>, ) -> Param<Tensor<B, D, Int>> { ... } fn map_bool<const D: usize>( &mut self, param: Param<Tensor<B, D, Bool>>, ) -> Param<Tensor<B, D, Bool>> { ... } }
Expand description

Module mapper trait for transforming module parameters.

Provided Methods§

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

Called when entering a submodule.

§Parameters
  • name: The name of the submodule being entered
  • container_type: The type of the container (e.g., “Module”, “Vec”, etc.)

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

Called when exiting a submodule.

§Parameters
  • name: The name of the submodule being exited
  • container_type: The type of the container (e.g., “Module”, “Vec”, etc.)

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

Map a float parameter in the module.

§Parameters
  • param: The float parameter to transform
§Returns

The transformed parameter

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.

§Parameters
  • param: The integer parameter to transform
§Returns

The transformed parameter

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.

§Parameters
  • param: The boolean parameter to transform
§Returns

The transformed parameter

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§

§

impl<B> ModuleMapper<B> for Quantizer
where B: Backend,

§

impl<B> ModuleMapper<B> for Reinitializer<B>
where B: Backend,