pub struct QuantizedTensor {
pub data: Vec<i8>,
pub shape: Vec<usize>,
pub params: QuantizationType,
}Expand description
Quantized INT8 tensor storage
Fields§
§data: Vec<i8>INT8 data
shape: Vec<usize>Shape
params: QuantizationTypePer-tensor or per-channel quantization
Implementations§
Source§impl QuantizedTensor
impl QuantizedTensor
Sourcepub fn from_float_symmetric(data: &[f32], shape: &[usize]) -> Self
pub fn from_float_symmetric(data: &[f32], shape: &[usize]) -> Self
Quantize a float tensor with per-tensor symmetric quantization
Sourcepub fn from_weights_per_channel(
weights: &[f32],
out_channels: usize,
in_channels: usize,
kernel_h: usize,
kernel_w: usize,
) -> Self
pub fn from_weights_per_channel( weights: &[f32], out_channels: usize, in_channels: usize, kernel_h: usize, kernel_w: usize, ) -> Self
Quantize weights with per-channel quantization
Sourcepub fn dequantize(&self) -> Vec<f32>
pub fn dequantize(&self) -> Vec<f32>
Dequantize back to float32
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§fn clone_from(&mut self, source: &Self)
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 UnsafeUnpin 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