pub struct JsTensorCompress { /* private fields */ }Expand description
Tensor compressor with adaptive level selection
Implementations§
Source§impl JsTensorCompress
impl JsTensorCompress
Sourcepub fn compress(
&self,
embedding: Vec<f32>,
access_freq: f32,
) -> Result<JsValue, JsValue>
pub fn compress( &self, embedding: Vec<f32>, access_freq: f32, ) -> Result<JsValue, JsValue>
Compress an embedding based on access frequency
§Arguments
embedding- The input embedding vector (Float32Array)access_freq- Access frequency in range [0.0, 1.0]- f > 0.8: Full precision (hot data)
- f > 0.4: Half precision (warm data)
- f > 0.1: 8-bit PQ (cool data)
- f > 0.01: 4-bit PQ (cold data)
- f <= 0.01: Binary (archive)
§Returns
Compressed tensor as JsValue
Sourcepub fn compress_with_level(
&self,
embedding: Vec<f32>,
level: &str,
) -> Result<JsValue, JsValue>
pub fn compress_with_level( &self, embedding: Vec<f32>, level: &str, ) -> Result<JsValue, JsValue>
Trait Implementations§
Source§impl From<JsTensorCompress> for JsValue
impl From<JsTensorCompress> for JsValue
Source§fn from(value: JsTensorCompress) -> Self
fn from(value: JsTensorCompress) -> Self
Converts to this type from the input type.
Source§impl FromWasmAbi for JsTensorCompress
impl FromWasmAbi for JsTensorCompress
Source§impl IntoWasmAbi for JsTensorCompress
impl IntoWasmAbi for JsTensorCompress
Source§impl OptionFromWasmAbi for JsTensorCompress
impl OptionFromWasmAbi for JsTensorCompress
Source§impl OptionIntoWasmAbi for JsTensorCompress
impl OptionIntoWasmAbi for JsTensorCompress
Source§impl RefFromWasmAbi for JsTensorCompress
impl RefFromWasmAbi for JsTensorCompress
Source§type Anchor = RcRef<JsTensorCompress>
type Anchor = RcRef<JsTensorCompress>
The type that holds the reference to
Self for the duration of the
invocation of the function that has an &Self parameter. This is
required to ensure that the lifetimes don’t persist beyond one function
call, and so that they remain anonymous.Source§impl RefMutFromWasmAbi for JsTensorCompress
impl RefMutFromWasmAbi for JsTensorCompress
Source§impl TryFromJsValue for JsTensorCompress
impl TryFromJsValue for JsTensorCompress
Source§impl VectorFromWasmAbi for JsTensorCompress
impl VectorFromWasmAbi for JsTensorCompress
type Abi = <Box<[JsValue]> as FromWasmAbi>::Abi
unsafe fn vector_from_abi(js: Self::Abi) -> Box<[JsTensorCompress]>
Source§impl VectorIntoWasmAbi for JsTensorCompress
impl VectorIntoWasmAbi for JsTensorCompress
type Abi = <Box<[JsValue]> as IntoWasmAbi>::Abi
fn vector_into_abi(vector: Box<[JsTensorCompress]>) -> Self::Abi
Source§impl WasmDescribeVector for JsTensorCompress
impl WasmDescribeVector for JsTensorCompress
impl SupportsConstructor for JsTensorCompress
impl SupportsInstanceProperty for JsTensorCompress
impl SupportsStaticProperty for JsTensorCompress
Auto Trait Implementations§
impl Freeze for JsTensorCompress
impl RefUnwindSafe for JsTensorCompress
impl Send for JsTensorCompress
impl Sync for JsTensorCompress
impl Unpin for JsTensorCompress
impl UnsafeUnpin for JsTensorCompress
impl UnwindSafe for JsTensorCompress
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> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
Source§type Abi = <T as IntoWasmAbi>::Abi
type Abi = <T as IntoWasmAbi>::Abi
Same as
IntoWasmAbi::AbiSource§fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
Same as
IntoWasmAbi::into_abi, except that it may throw and never
return in the case of Err.