pub struct StateCompressor { /* private fields */ }Expand description
State compressor with configurable compression method
Implementations§
Source§impl StateCompressor
impl StateCompressor
Sourcepub fn new(method: CompressionMethod) -> Self
pub fn new(method: CompressionMethod) -> Self
Create a new state compressor
Sourcepub fn with_sparsity_threshold(self, threshold: f32) -> Self
pub fn with_sparsity_threshold(self, threshold: f32) -> Self
Set sparsity threshold
Sourcepub fn compress(&self, state: &HiddenState) -> InferenceResult<CompressedState>
pub fn compress(&self, state: &HiddenState) -> InferenceResult<CompressedState>
Compress a hidden state
Sourcepub fn decompress(
&self,
compressed: &CompressedState,
) -> InferenceResult<HiddenState>
pub fn decompress( &self, compressed: &CompressedState, ) -> InferenceResult<HiddenState>
Decompress a compressed state
Auto Trait Implementations§
impl Freeze for StateCompressor
impl RefUnwindSafe for StateCompressor
impl Send for StateCompressor
impl Sync for StateCompressor
impl Unpin for StateCompressor
impl UnwindSafe for StateCompressor
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more