pub struct SparseInferenceEngine { /* private fields */ }Expand description
Sparse inference engine that coordinates prediction and computation
Implementations§
Source§impl SparseInferenceEngine
impl SparseInferenceEngine
Sourcepub fn new_sparse(
input_dim: usize,
hidden_dim: usize,
sparsity_ratio: f32,
) -> Result<Self>
pub fn new_sparse( input_dim: usize, hidden_dim: usize, sparsity_ratio: f32, ) -> Result<Self>
Create a new sparse inference engine with sparsity
The sparsity_ratio determines what fraction of neurons are kept active (0.0-1.0) e.g., sparsity_ratio=0.3 means 30% of neurons are active (70% sparsity)
Sourcepub fn new_dense(input_dim: usize, hidden_dim: usize) -> Result<Self>
pub fn new_dense(input_dim: usize, hidden_dim: usize) -> Result<Self>
Create a dense (non-sparse) inference engine for comparison
Sourcepub fn calibrate(&mut self, samples: &[Vec<f32>]) -> Result<()>
pub fn calibrate(&mut self, samples: &[Vec<f32>]) -> Result<()>
Calibrate the predictor with sample data
Sourcepub fn sparsity_statistics(&self) -> SparsityStats
pub fn sparsity_statistics(&self) -> SparsityStats
Get sparsity statistics
Auto Trait Implementations§
impl Freeze for SparseInferenceEngine
impl !RefUnwindSafe for SparseInferenceEngine
impl Send for SparseInferenceEngine
impl Sync for SparseInferenceEngine
impl Unpin for SparseInferenceEngine
impl !UnwindSafe for SparseInferenceEngine
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