pub struct WeightTensor {
pub data: Vec<f32>,
pub shape: Vec<usize>,
pub name: String,
}Expand description
Weight tensor for pruning operations
Represents a named tensor with shape information, suitable for layer-wise or global pruning operations.
Fields§
§data: Vec<f32>Weight data in row-major order
shape: Vec<usize>Shape of the tensor (e.g., [out_channels, in_channels, kernel_h, kernel_w])
name: StringLayer name for identification
Implementations§
Source§impl WeightTensor
impl WeightTensor
Sourcepub fn new(data: Vec<f32>, shape: Vec<usize>, name: String) -> Self
pub fn new(data: Vec<f32>, shape: Vec<usize>, name: String) -> Self
Creates a new weight tensor
Sourcepub fn validate(&self) -> Result<()>
pub fn validate(&self) -> Result<()>
Validates that shape matches data length
§Errors
Returns an error if shape product does not match data length
Sourcepub fn statistics(&self) -> WeightStatistics
pub fn statistics(&self) -> WeightStatistics
Returns statistics about the weight distribution
Trait Implementations§
Source§impl Clone for WeightTensor
impl Clone for WeightTensor
Source§fn clone(&self) -> WeightTensor
fn clone(&self) -> WeightTensor
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 WeightTensor
impl RefUnwindSafe for WeightTensor
impl Send for WeightTensor
impl Sync for WeightTensor
impl Unpin for WeightTensor
impl UnsafeUnpin for WeightTensor
impl UnwindSafe for WeightTensor
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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