pub struct HistogramCollector {
pub num_bins: usize,
pub histograms: Vec<(String, TensorHistogram)>,
}Expand description
Histogram collector that aggregates activation values across calibration samples.
Fields§
§num_bins: usizeNumber of bins for histograms.
histograms: Vec<(String, TensorHistogram)>Collected histograms, keyed by tensor name.
Implementations§
Source§impl HistogramCollector
impl HistogramCollector
Sourcepub fn add_values(
&mut self,
name: &str,
values: &[f32],
) -> Result<(), CalibrationError>
pub fn add_values( &mut self, name: &str, values: &[f32], ) -> Result<(), CalibrationError>
Add values for a named tensor. If a histogram already exists for this tensor, the new values are merged into it.
Sourcepub fn collect_from_dataset(
&mut self,
dataset: &CalibrationDataset,
tensor_name: &str,
) -> Result<(), CalibrationError>
pub fn collect_from_dataset( &mut self, dataset: &CalibrationDataset, tensor_name: &str, ) -> Result<(), CalibrationError>
Collect histograms from a calibration dataset.
Each sample is treated as a single tensor named tensor_name.
Sourcepub fn get(&self, name: &str) -> Option<&TensorHistogram>
pub fn get(&self, name: &str) -> Option<&TensorHistogram>
Get the histogram for a named tensor.
Trait Implementations§
Source§impl Clone for HistogramCollector
impl Clone for HistogramCollector
Source§fn clone(&self) -> HistogramCollector
fn clone(&self) -> HistogramCollector
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for HistogramCollector
impl Debug for HistogramCollector
Auto Trait Implementations§
impl Freeze for HistogramCollector
impl RefUnwindSafe for HistogramCollector
impl Send for HistogramCollector
impl Sync for HistogramCollector
impl Unpin for HistogramCollector
impl UnsafeUnpin for HistogramCollector
impl UnwindSafe for HistogramCollector
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