pub struct PretrainedWeightLoader { /* private fields */ }
Expand description
Pre-trained model weight loader
Implementations§
Source§impl PretrainedWeightLoader
impl PretrainedWeightLoader
Sourcepub fn load_weights(
&mut self,
weights: HashMap<String, ArrayD<f32>>,
) -> Result<()>
pub fn load_weights( &mut self, weights: HashMap<String, ArrayD<f32>>, ) -> Result<()>
Load weights from a dictionary
Sourcepub fn add_layer_mapping(&mut self, source_layer: String, target_layer: String)
pub fn add_layer_mapping(&mut self, source_layer: String, target_layer: String)
Add layer mapping for weight transfer
Sourcepub fn set_ignore_mismatches(&mut self, ignore: bool)
pub fn set_ignore_mismatches(&mut self, ignore: bool)
Set whether to ignore size mismatches
Sourcepub fn apply_weights_to_layer<L: Layer<f32>>(
&self,
layer: &mut L,
layer_name: &str,
) -> Result<bool>
pub fn apply_weights_to_layer<L: Layer<f32>>( &self, layer: &mut L, layer_name: &str, ) -> Result<bool>
Apply weights to a model layer with shape compatibility checking
Sourcepub fn get_available_weights(&self) -> Vec<String>
pub fn get_available_weights(&self) -> Vec<String>
Get available weight keys
Sourcepub fn get_weight_statistics(&self) -> HashMap<String, WeightStatistics>
pub fn get_weight_statistics(&self) -> HashMap<String, WeightStatistics>
Get weight statistics for analysis
Sourcepub fn check_weight_compatibility(
&self,
expected_shapes: &HashMap<String, Vec<usize>>,
) -> CompatibilityReport
pub fn check_weight_compatibility( &self, expected_shapes: &HashMap<String, Vec<usize>>, ) -> CompatibilityReport
Check weight compatibility with expected shapes
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PretrainedWeightLoader
impl RefUnwindSafe for PretrainedWeightLoader
impl Send for PretrainedWeightLoader
impl Sync for PretrainedWeightLoader
impl Unpin for PretrainedWeightLoader
impl UnwindSafe for PretrainedWeightLoader
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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