pub struct SparsityConfig {
pub threshold: Option<f32>,
pub top_k: Option<usize>,
pub target_sparsity: Option<f32>,
pub adaptive_threshold: bool,
}Expand description
Configuration for sparsity settings.
Fields§
§threshold: Option<f32>Activation threshold τ for neuron selection.
top_k: Option<usize>Top-K neuron selection (alternative to threshold).
target_sparsity: Option<f32>Target sparsity ratio (0.0 to 1.0). Used for automatic threshold calibration.
adaptive_threshold: boolEnable adaptive threshold adjustment.
Implementations§
Source§impl SparsityConfig
impl SparsityConfig
Sourcepub fn with_threshold(threshold: f32) -> Self
pub fn with_threshold(threshold: f32) -> Self
Create config with threshold-based selection.
Sourcepub fn with_top_k(k: usize) -> Self
pub fn with_top_k(k: usize) -> Self
Create config with top-K selection.
Sourcepub fn with_target_sparsity(sparsity: f32) -> Self
pub fn with_target_sparsity(sparsity: f32) -> Self
Create config with target sparsity ratio.
Trait Implementations§
Source§impl Clone for SparsityConfig
impl Clone for SparsityConfig
Source§fn clone(&self) -> SparsityConfig
fn clone(&self) -> SparsityConfig
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 SparsityConfig
impl Debug for SparsityConfig
Source§impl Default for SparsityConfig
impl Default for SparsityConfig
Source§impl<'de> Deserialize<'de> for SparsityConfig
impl<'de> Deserialize<'de> for SparsityConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for SparsityConfig
impl RefUnwindSafe for SparsityConfig
impl Send for SparsityConfig
impl Sync for SparsityConfig
impl Unpin for SparsityConfig
impl UnwindSafe for SparsityConfig
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