pub struct WeightCompressor { /* private fields */ }Expand description
Advanced weight compressor
Implementations§
Source§impl WeightCompressor
impl WeightCompressor
Sourcepub fn new(config: CompressionConfig) -> Self
pub fn new(config: CompressionConfig) -> Self
Create a new weight compressor
Sourcepub fn compress_weights(
&self,
model_data: &[u8],
) -> Result<CompressedModelData, JsValue>
pub fn compress_weights( &self, model_data: &[u8], ) -> Result<CompressedModelData, JsValue>
Compress model weights using the configured strategy
Sourcepub fn analyze_sensitivity(
&mut self,
model_data: &[u8],
) -> Result<Vec<f32>, JsValue>
pub fn analyze_sensitivity( &mut self, model_data: &[u8], ) -> Result<Vec<f32>, JsValue>
Analyze model sensitivity to compression
Sourcepub fn get_recommended_settings(
&self,
model_size_bytes: usize,
target_size_bytes: usize,
) -> CompressionConfig
pub fn get_recommended_settings( &self, model_size_bytes: usize, target_size_bytes: usize, ) -> CompressionConfig
Get recommended compression settings for a model
Trait Implementations§
Source§impl From<WeightCompressor> for JsValue
impl From<WeightCompressor> for JsValue
Source§fn from(value: WeightCompressor) -> Self
fn from(value: WeightCompressor) -> Self
Converts to this type from the input type.
Source§impl FromWasmAbi for WeightCompressor
impl FromWasmAbi for WeightCompressor
Source§impl IntoWasmAbi for WeightCompressor
impl IntoWasmAbi for WeightCompressor
Source§impl OptionFromWasmAbi for WeightCompressor
impl OptionFromWasmAbi for WeightCompressor
Source§impl OptionIntoWasmAbi for WeightCompressor
impl OptionIntoWasmAbi for WeightCompressor
Source§impl RefFromWasmAbi for WeightCompressor
impl RefFromWasmAbi for WeightCompressor
Source§type Anchor = RcRef<WeightCompressor>
type Anchor = RcRef<WeightCompressor>
The type that holds the reference to
Self for the duration of the
invocation of the function that has an &Self parameter. This is
required to ensure that the lifetimes don’t persist beyond one function
call, and so that they remain anonymous.Source§impl RefMutFromWasmAbi for WeightCompressor
impl RefMutFromWasmAbi for WeightCompressor
Source§impl TryFromJsValue for WeightCompressor
impl TryFromJsValue for WeightCompressor
Source§impl VectorFromWasmAbi for WeightCompressor
impl VectorFromWasmAbi for WeightCompressor
type Abi = <Box<[JsValue]> as FromWasmAbi>::Abi
unsafe fn vector_from_abi(js: Self::Abi) -> Box<[WeightCompressor]>
Source§impl VectorIntoWasmAbi for WeightCompressor
impl VectorIntoWasmAbi for WeightCompressor
type Abi = <Box<[JsValue]> as IntoWasmAbi>::Abi
fn vector_into_abi(vector: Box<[WeightCompressor]>) -> Self::Abi
Source§impl WasmDescribeVector for WeightCompressor
impl WasmDescribeVector for WeightCompressor
impl SupportsConstructor for WeightCompressor
impl SupportsInstanceProperty for WeightCompressor
impl SupportsStaticProperty for WeightCompressor
Auto Trait Implementations§
impl Freeze for WeightCompressor
impl RefUnwindSafe for WeightCompressor
impl Send for WeightCompressor
impl Sync for WeightCompressor
impl Unpin for WeightCompressor
impl UnsafeUnpin for WeightCompressor
impl UnwindSafe for WeightCompressor
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> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
Source§type Abi = <T as IntoWasmAbi>::Abi
type Abi = <T as IntoWasmAbi>::Abi
Same as
IntoWasmAbi::AbiSource§fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
Same as
IntoWasmAbi::into_abi, except that it may throw and never
return in the case of Err.