pub struct TensorHistogram {
pub min: f32,
pub max: f32,
pub bins: Vec<u32>,
pub bin_edges: Vec<f32>,
pub total_count: u64,
}Expand description
Histogram of activation values for a single tensor.
Fields§
§min: f32Observed minimum value.
max: f32Observed maximum value.
bins: Vec<u32>Bin counts.
bin_edges: Vec<f32>Bin edges (len = bins.len() + 1).
total_count: u64Total number of values collected.
Implementations§
Source§impl TensorHistogram
impl TensorHistogram
Sourcepub fn from_values(
values: &[f32],
num_bins: usize,
) -> Result<Self, CalibrationError>
pub fn from_values( values: &[f32], num_bins: usize, ) -> Result<Self, CalibrationError>
Create a new histogram from a collection of f32 values.
The histogram covers the range [min, max] of the input values
with num_bins equal-width bins.
Sourcepub fn merge(&mut self, other: &TensorHistogram)
pub fn merge(&mut self, other: &TensorHistogram)
Merge another histogram’s values into this one.
If the ranges differ, the histogram is rebuilt with the union range.
Sourcepub fn percentile(&self, pct: f32) -> f32
pub fn percentile(&self, pct: f32) -> f32
Compute the value at a given percentile (0.0 to 100.0).
Trait Implementations§
Source§impl Clone for TensorHistogram
impl Clone for TensorHistogram
Source§fn clone(&self) -> TensorHistogram
fn clone(&self) -> TensorHistogram
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 moreAuto Trait Implementations§
impl Freeze for TensorHistogram
impl RefUnwindSafe for TensorHistogram
impl Send for TensorHistogram
impl Sync for TensorHistogram
impl Unpin for TensorHistogram
impl UnsafeUnpin for TensorHistogram
impl UnwindSafe for TensorHistogram
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