pub struct SparseEmbeddingProvider { /* private fields */ }Expand description
Sparse embedding provider for Ruvector integration
Implements the EmbeddingProvider interface using PowerInfer-style sparse inference for efficient embedding generation.
Implementations§
Source§impl SparseEmbeddingProvider
impl SparseEmbeddingProvider
Sourcepub fn new(
input_dim: usize,
hidden_dim: usize,
embed_dim: usize,
sparsity_ratio: f32,
) -> Result<Self>
pub fn new( input_dim: usize, hidden_dim: usize, embed_dim: usize, sparsity_ratio: f32, ) -> Result<Self>
Create a new sparse embedding provider with specified dimensions
Sourcepub fn from_gguf_bytes(data: &[u8]) -> Result<Self>
pub fn from_gguf_bytes(data: &[u8]) -> Result<Self>
Create from GGUF model bytes
Sourcepub fn embed_batch(&self, inputs: &[Vec<f32>]) -> Result<Vec<Vec<f32>>>
pub fn embed_batch(&self, inputs: &[Vec<f32>]) -> Result<Vec<Vec<f32>>>
Batch embed multiple inputs
Sourcepub fn embedding_dim(&self) -> usize
pub fn embedding_dim(&self) -> usize
Get embedding dimension
Sourcepub fn sparsity_stats(&self) -> &SparsityStats
pub fn sparsity_stats(&self) -> &SparsityStats
Get sparsity statistics
Sourcepub fn set_sparsity_threshold(&mut self, threshold: f32)
pub fn set_sparsity_threshold(&mut self, threshold: f32)
Set sparsity threshold
Trait Implementations§
Source§impl EmbeddingProvider for SparseEmbeddingProvider
impl EmbeddingProvider for SparseEmbeddingProvider
Auto Trait Implementations§
impl Freeze for SparseEmbeddingProvider
impl RefUnwindSafe for SparseEmbeddingProvider
impl Send for SparseEmbeddingProvider
impl Sync for SparseEmbeddingProvider
impl Unpin for SparseEmbeddingProvider
impl UnwindSafe for SparseEmbeddingProvider
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