pub struct CompressionConfig { /* private fields */ }Expand description
Compression configuration
Implementations§
Source§impl CompressionConfig
impl CompressionConfig
Sourcepub fn new(strategy: CompressionStrategy, level: CompressionLevel) -> Self
pub fn new(strategy: CompressionStrategy, level: CompressionLevel) -> Self
Create a new compression configuration
Sourcepub fn transformer() -> Self
pub fn transformer() -> Self
Create a configuration optimized for transformer models
Sourcepub fn set_target_sparsity(self, sparsity: f32) -> Self
pub fn set_target_sparsity(self, sparsity: f32) -> Self
Set target sparsity ratio (0.0 - 1.0)
Sourcepub fn set_accuracy_threshold(self, threshold: f32) -> Self
pub fn set_accuracy_threshold(self, threshold: f32) -> Self
Set accuracy preservation threshold
Sourcepub fn set_preserve_attention(self, preserve: bool) -> Self
pub fn set_preserve_attention(self, preserve: bool) -> Self
Enable/disable attention preservation
Sourcepub fn set_preserve_embeddings(self, preserve: bool) -> Self
pub fn set_preserve_embeddings(self, preserve: bool) -> Self
Enable/disable embedding preservation
Sourcepub fn set_knowledge_distillation(self, enable: bool) -> Self
pub fn set_knowledge_distillation(self, enable: bool) -> Self
Enable/disable knowledge distillation
Trait Implementations§
Source§impl Clone for CompressionConfig
impl Clone for CompressionConfig
Source§fn clone(&self) -> CompressionConfig
fn clone(&self) -> CompressionConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CompressionConfig
impl Debug for CompressionConfig
Source§impl From<CompressionConfig> for JsValue
impl From<CompressionConfig> for JsValue
Source§fn from(value: CompressionConfig) -> Self
fn from(value: CompressionConfig) -> Self
Converts to this type from the input type.
Source§impl FromWasmAbi for CompressionConfig
impl FromWasmAbi for CompressionConfig
Source§impl IntoWasmAbi for CompressionConfig
impl IntoWasmAbi for CompressionConfig
Source§impl RefFromWasmAbi for CompressionConfig
impl RefFromWasmAbi for CompressionConfig
Source§type Anchor = RcRef<CompressionConfig>
type Anchor = RcRef<CompressionConfig>
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 TryFromJsValue for CompressionConfig
impl TryFromJsValue for CompressionConfig
Source§impl VectorFromWasmAbi for CompressionConfig
impl VectorFromWasmAbi for CompressionConfig
type Abi = <Box<[JsValue]> as FromWasmAbi>::Abi
unsafe fn vector_from_abi(js: Self::Abi) -> Box<[CompressionConfig]>
Source§impl VectorIntoWasmAbi for CompressionConfig
impl VectorIntoWasmAbi for CompressionConfig
type Abi = <Box<[JsValue]> as IntoWasmAbi>::Abi
fn vector_into_abi(vector: Box<[CompressionConfig]>) -> Self::Abi
Source§impl WasmDescribeVector for CompressionConfig
impl WasmDescribeVector for CompressionConfig
impl SupportsConstructor for CompressionConfig
impl SupportsInstanceProperty for CompressionConfig
impl SupportsStaticProperty for CompressionConfig
Auto Trait Implementations§
impl Freeze for CompressionConfig
impl RefUnwindSafe for CompressionConfig
impl Send for CompressionConfig
impl Sync for CompressionConfig
impl Unpin for CompressionConfig
impl UnsafeUnpin for CompressionConfig
impl UnwindSafe for CompressionConfig
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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.