pub struct CalibrationData {
pub min: f32,
pub max: f32,
pub mean: f32,
pub std_dev: f32,
pub num_samples: usize,
/* private fields */
}Expand description
Calibration data collected from sample inputs.
Fields§
§min: f32Minimum value seen.
max: f32Maximum value seen.
mean: f32Mean value.
std_dev: f32Standard deviation.
num_samples: usizeNumber of samples.
Implementations§
Source§impl CalibrationData
impl CalibrationData
Sourcepub fn new(tensor: &Tensor<f32>, num_bins: usize) -> Self
pub fn new(tensor: &Tensor<f32>, num_bins: usize) -> Self
Creates new calibration data from initial tensor.
Sourcepub fn dynamic_range(&self) -> f32
pub fn dynamic_range(&self) -> f32
Returns the dynamic range.
Sourcepub fn symmetric_scale(&self, quant_type: QuantType) -> f32
pub fn symmetric_scale(&self, quant_type: QuantType) -> f32
Computes the optimal scale for symmetric quantization.
Sourcepub fn asymmetric_scale(&self, quant_type: QuantType) -> (f32, f32)
pub fn asymmetric_scale(&self, quant_type: QuantType) -> (f32, f32)
Computes the optimal scale for asymmetric quantization.
Sourcepub fn percentile(&self, p: f32) -> f32
pub fn percentile(&self, p: f32) -> f32
Returns the percentile value from the histogram.
Trait Implementations§
Source§impl Clone for CalibrationData
impl Clone for CalibrationData
Source§fn clone(&self) -> CalibrationData
fn clone(&self) -> CalibrationData
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 CalibrationData
impl RefUnwindSafe for CalibrationData
impl Send for CalibrationData
impl Sync for CalibrationData
impl Unpin for CalibrationData
impl UnwindSafe for CalibrationData
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