pub struct QuantizedTensor {
pub data: ArrayD<i8>,
pub params: QuantizationParams,
pub shape: Vec<usize>,
}
Expand description
Quantized tensor representation
Fields§
§data: ArrayD<i8>
Quantized integer data
params: QuantizationParams
Quantization parameters
shape: Vec<usize>
Original tensor shape
Implementations§
Source§impl QuantizedTensor
impl QuantizedTensor
Sourcepub fn from_float(
tensor: &ArrayD<f32>,
config: &QuantizationConfig,
) -> Result<Self>
pub fn from_float( tensor: &ArrayD<f32>, config: &QuantizationConfig, ) -> Result<Self>
Create new quantized tensor from float tensor
Sourcepub fn dequantize(&self) -> ArrayD<f32>
pub fn dequantize(&self) -> ArrayD<f32>
Dequantize back to float tensor
Sourcepub fn size_bytes(&self) -> usize
pub fn size_bytes(&self) -> usize
Get quantized tensor size in bytes
Sourcepub fn compression_ratio(&self) -> f32
pub fn compression_ratio(&self) -> f32
Get compression ratio compared to f32
Trait Implementations§
Source§impl Clone for QuantizedTensor
impl Clone for QuantizedTensor
Source§fn clone(&self) -> QuantizedTensor
fn clone(&self) -> QuantizedTensor
Returns a duplicate of the value. Read more
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for QuantizedTensor
impl RefUnwindSafe for QuantizedTensor
impl Send for QuantizedTensor
impl Sync for QuantizedTensor
impl Unpin for QuantizedTensor
impl UnwindSafe for QuantizedTensor
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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