pub struct FibKvCodec { /* private fields */ }Expand description
KV cache codec wrapping fib-quant’s KV compression.
Implementations§
Source§impl FibKvCodec
impl FibKvCodec
Sourcepub fn new(
fib_profile: FibQuantProfileV1,
kv_profile: KvCompressionProfileV1,
) -> Result<Self, QuantCodecError>
pub fn new( fib_profile: FibQuantProfileV1, kv_profile: KvCompressionProfileV1, ) -> Result<Self, QuantCodecError>
Build a KV codec from a fib-quant profile and KV compression profile.
Sourcepub fn quantizer(&self) -> &FibQuantizer
pub fn quantizer(&self) -> &FibQuantizer
Access the underlying quantizer.
Trait Implementations§
Source§impl KvCacheCodec for FibKvCodec
impl KvCacheCodec for FibKvCodec
type EncodedCache = KvEncodedTensorV1
fn encode_kv_cache( &self, tensors: &[f32], shape: KvTensorShape, ) -> Result<Self::EncodedCache, Self::Error>
fn decode_slice( &self, cache: &Self::EncodedCache, request: KvSliceRequest, out: &mut [f32], ) -> Result<(), Self::Error>
Source§impl VectorCodec for FibKvCodec
impl VectorCodec for FibKvCodec
type EncodedBlock = FibCodeV1
type Error = QuantCodecError
fn encode_block(&self, input: &[f32]) -> Result<Self::EncodedBlock, Self::Error>
fn decode_block( &self, block: &Self::EncodedBlock, out: &mut [f32], ) -> Result<(), Self::Error>
Auto Trait Implementations§
impl Freeze for FibKvCodec
impl RefUnwindSafe for FibKvCodec
impl Send for FibKvCodec
impl Sync for FibKvCodec
impl Unpin for FibKvCodec
impl UnsafeUnpin for FibKvCodec
impl UnwindSafe for FibKvCodec
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> 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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.