pub struct TensorStats {
pub tensor_id: usize,
pub shape: Vec<usize>,
pub num_elements: usize,
pub dtype: String,
pub min_value: Option<f64>,
pub max_value: Option<f64>,
pub mean_value: Option<f64>,
pub std_dev: Option<f64>,
pub num_nans: Option<usize>,
pub num_infs: Option<usize>,
}Expand description
Tensor statistics for inspection.
Fields§
§tensor_id: usizeTensor ID
shape: Vec<usize>Shape of the tensor
num_elements: usizeNumber of elements
dtype: StringData type
min_value: Option<f64>Minimum value (if computed)
max_value: Option<f64>Maximum value (if computed)
mean_value: Option<f64>Mean value (if computed)
std_dev: Option<f64>Standard deviation (if computed)
num_nans: Option<usize>Number of NaN values
num_infs: Option<usize>Number of infinite values
Implementations§
Source§impl TensorStats
impl TensorStats
Sourcepub fn new(
tensor_id: usize,
shape: Vec<usize>,
dtype: impl Into<String>,
) -> Self
pub fn new( tensor_id: usize, shape: Vec<usize>, dtype: impl Into<String>, ) -> Self
Create tensor stats with basic information.
Sourcepub fn with_statistics(
self,
min: f64,
max: f64,
mean: f64,
std_dev: f64,
num_nans: usize,
num_infs: usize,
) -> Self
pub fn with_statistics( self, min: f64, max: f64, mean: f64, std_dev: f64, num_nans: usize, num_infs: usize, ) -> Self
Add computed statistics.
Sourcepub fn has_numerical_issues(&self) -> bool
pub fn has_numerical_issues(&self) -> bool
Check if the tensor has numerical issues.
Trait Implementations§
Source§impl Clone for TensorStats
impl Clone for TensorStats
Source§fn clone(&self) -> TensorStats
fn clone(&self) -> TensorStats
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 moreSource§impl Debug for TensorStats
impl Debug for TensorStats
Auto Trait Implementations§
impl Freeze for TensorStats
impl RefUnwindSafe for TensorStats
impl Send for TensorStats
impl Sync for TensorStats
impl Unpin for TensorStats
impl UnwindSafe for TensorStats
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