pub struct TernLayer {
pub name: String,
pub scale: f32,
pub storage: LayerStorage,
pub sparsity: f64,
pub original_dtype: String,
}Expand description
One compressed weight matrix (one transformer projection, etc.).
Fields§
§name: StringLayer name (e.g. “model.layers.0.self_attn.q_proj.weight”).
scale: f32Per-layer scale α = mean(|W_original|).
storage: LayerStorageWeight storage (dense or sparse).
sparsity: f64Fraction of zero weights.
original_dtype: StringOriginal dtype (for metadata / roundtrip info).
Implementations§
Source§impl TernLayer
impl TernLayer
Sourcepub fn num_params(&self) -> usize
pub fn num_params(&self) -> usize
Total number of parameters in this layer.
Sourcepub fn memory_bytes(&self) -> usize
pub fn memory_bytes(&self) -> usize
Memory used by ternary weights in bytes.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for TernLayer
impl<'de> Deserialize<'de> for TernLayer
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for TernLayer
impl RefUnwindSafe for TernLayer
impl Send for TernLayer
impl Sync for TernLayer
impl Unpin for TernLayer
impl UnsafeUnpin for TernLayer
impl UnwindSafe for TernLayer
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