pub struct MobileCompressionEngine { /* private fields */ }Expand description
Advanced model compression system
Implementations§
Source§impl MobileCompressionEngine
impl MobileCompressionEngine
Sourcepub fn new(
config: CompressionConfig,
device_info: &MobileDeviceInfo,
) -> Result<Self>
pub fn new( config: CompressionConfig, device_info: &MobileDeviceInfo, ) -> Result<Self>
Create new compression engine
Sourcepub fn compress_model(
&mut self,
model_weights: &HashMap<String, Tensor>,
) -> Result<HashMap<String, Tensor>>
pub fn compress_model( &mut self, model_weights: &HashMap<String, Tensor>, ) -> Result<HashMap<String, Tensor>>
Compress a model using the configured strategies
Sourcepub fn progressive_compress(
&mut self,
model_weights: &HashMap<String, Tensor>,
validation_fn: Option<Box<dyn Fn(&HashMap<String, Tensor>) -> Result<f32>>>,
) -> Result<HashMap<String, Tensor>>
pub fn progressive_compress( &mut self, model_weights: &HashMap<String, Tensor>, validation_fn: Option<Box<dyn Fn(&HashMap<String, Tensor>) -> Result<f32>>>, ) -> Result<HashMap<String, Tensor>>
Apply progressive compression over multiple stages
Sourcepub fn create_device_optimized_config(
device_info: &MobileDeviceInfo,
) -> CompressionConfig
pub fn create_device_optimized_config( device_info: &MobileDeviceInfo, ) -> CompressionConfig
Create device-optimized compression configuration
Sourcepub fn get_stats(&self) -> &CompressionStats
pub fn get_stats(&self) -> &CompressionStats
Get compression statistics
Sourcepub fn estimate_compression_benefits(
&self,
model_size_mb: f32,
device_info: &MobileDeviceInfo,
) -> CompressionBenefits
pub fn estimate_compression_benefits( &self, model_size_mb: f32, device_info: &MobileDeviceInfo, ) -> CompressionBenefits
Estimate compression benefits for configuration
Auto Trait Implementations§
impl Freeze for MobileCompressionEngine
impl !RefUnwindSafe for MobileCompressionEngine
impl !Send for MobileCompressionEngine
impl !Sync for MobileCompressionEngine
impl Unpin for MobileCompressionEngine
impl UnsafeUnpin for MobileCompressionEngine
impl !UnwindSafe for MobileCompressionEngine
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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