pub struct TensorCompress { /* private fields */ }Expand description
Tensor compressor with adaptive level selection
Implementations§
Source§impl TensorCompress
impl TensorCompress
pub fn into_reference( val: TensorCompress, env: Env, ) -> Result<Reference<TensorCompress>>
pub fn into_instance(self, env: Env) -> Result<ClassInstance<TensorCompress>>
Source§impl TensorCompress
impl TensorCompress
Sourcepub fn compress_with_level(
&self,
embedding: Vec<f64>,
level: CompressionLevelConfig,
) -> Result<String>
pub fn compress_with_level( &self, embedding: Vec<f64>, level: CompressionLevelConfig, ) -> Result<String>
Compress with explicit compression level
§Arguments
embedding- The input embedding vectorlevel- Compression level configuration
§Returns
Compressed tensor as JSON string
§Example
const embedding = [1.0, 2.0, 3.0, 4.0];
const level = { level_type: "half", scale: 1.0 };
const compressed = compressor.compressWithLevel(embedding, level);Trait Implementations§
Source§impl FromNapiMutRef for TensorCompress
impl FromNapiMutRef for TensorCompress
Source§unsafe fn from_napi_mut_ref(
env: napi_env,
napi_val: napi_value,
) -> Result<&'static mut Self>
unsafe fn from_napi_mut_ref( env: napi_env, napi_val: napi_value, ) -> Result<&'static mut Self>
Safety Read more
Source§impl FromNapiRef for TensorCompress
impl FromNapiRef for TensorCompress
Source§unsafe fn from_napi_ref(
env: napi_env,
napi_val: napi_value,
) -> Result<&'static Self>
unsafe fn from_napi_ref( env: napi_env, napi_val: napi_value, ) -> Result<&'static Self>
Safety Read more
Source§impl FromNapiValue for &TensorCompress
impl FromNapiValue for &TensorCompress
Source§unsafe fn from_napi_value(env: napi_env, napi_val: napi_value) -> Result<Self>
unsafe fn from_napi_value(env: napi_env, napi_val: napi_value) -> Result<Self>
Safety Read more
fn from_unknown(value: JsUnknown) -> Result<Self, Error>
Source§impl FromNapiValue for &mut TensorCompress
impl FromNapiValue for &mut TensorCompress
Source§unsafe fn from_napi_value(env: napi_env, napi_val: napi_value) -> Result<Self>
unsafe fn from_napi_value(env: napi_env, napi_val: napi_value) -> Result<Self>
Safety Read more
fn from_unknown(value: JsUnknown) -> Result<Self, Error>
Source§impl ObjectFinalize for TensorCompress
impl ObjectFinalize for TensorCompress
Source§impl ToNapiValue for TensorCompress
impl ToNapiValue for TensorCompress
Source§unsafe fn to_napi_value(
env: napi_env,
val: TensorCompress,
) -> Result<napi_value>
unsafe fn to_napi_value( env: napi_env, val: TensorCompress, ) -> Result<napi_value>
Safety Read more
Source§impl TypeName for &TensorCompress
impl TypeName for &TensorCompress
Source§impl TypeName for &mut TensorCompress
impl TypeName for &mut TensorCompress
Source§impl TypeName for TensorCompress
impl TypeName for TensorCompress
Source§impl ValidateNapiValue for &TensorCompress
impl ValidateNapiValue for &TensorCompress
Source§unsafe fn validate(env: napi_env, napi_val: napi_value) -> Result<napi_value>
unsafe fn validate(env: napi_env, napi_val: napi_value) -> Result<napi_value>
Safety Read more
Source§impl ValidateNapiValue for &mut TensorCompress
impl ValidateNapiValue for &mut TensorCompress
Source§unsafe fn validate(env: napi_env, napi_val: napi_value) -> Result<napi_value>
unsafe fn validate(env: napi_env, napi_val: napi_value) -> Result<napi_value>
Safety Read more
Auto Trait Implementations§
impl Freeze for TensorCompress
impl RefUnwindSafe for TensorCompress
impl Send for TensorCompress
impl Sync for TensorCompress
impl Unpin for TensorCompress
impl UnwindSafe for TensorCompress
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