pub struct LinearFormatSpec { /* private fields */ }Expand description
Architecture-owned physical encoding and exact companion parameters.
Backends consume these identities literally. They must never derive scale or affine-bias names from the primary weight identity.
Implementations§
Source§impl LinearFormatSpec
impl LinearFormatSpec
Sourcepub fn unscaled(format: LinearFormat) -> Result<Self, Error>
pub fn unscaled(format: LinearFormat) -> Result<Self, Error>
Declares a dense or checkpoint-native encoding with no companions.
Sourcepub fn scaled(format: LinearFormat, scale: ParameterSpec) -> Result<Self, Error>
pub fn scaled(format: LinearFormat, scale: ParameterSpec) -> Result<Self, Error>
Declares an encoding with one exact scale companion.
Sourcepub fn affine(
format: LinearFormat,
scale: ParameterSpec,
affine_bias: ParameterSpec,
) -> Result<Self, Error>
pub fn affine( format: LinearFormat, scale: ParameterSpec, affine_bias: ParameterSpec, ) -> Result<Self, Error>
Declares an affine encoding with exact scale and bias companions.
Sourcepub const fn encoding(&self) -> LinearFormat
pub const fn encoding(&self) -> LinearFormat
Physical tensor encoding.
Sourcepub const fn scale(&self) -> Option<&ParameterSpec>
pub const fn scale(&self) -> Option<&ParameterSpec>
Exact scale companion, when stored separately.
Sourcepub const fn affine_bias(&self) -> Option<&ParameterSpec>
pub const fn affine_bias(&self) -> Option<&ParameterSpec>
Exact affine-bias companion, when stored separately.
Sourcepub fn validate(&self) -> Result<(), Error>
pub fn validate(&self) -> Result<(), Error>
Validates that companion cardinality matches the physical encoding.
Sourcepub fn validate_for_weight(&self, weight: &ParameterSpec) -> Result<(), Error>
pub fn validate_for_weight(&self, weight: &ParameterSpec) -> Result<(), Error>
Validates companions against the primary weight identity.
Trait Implementations§
Source§impl Clone for LinearFormatSpec
impl Clone for LinearFormatSpec
Source§fn clone(&self) -> LinearFormatSpec
fn clone(&self) -> LinearFormatSpec
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 LinearFormatSpec
impl Debug for LinearFormatSpec
impl Eq for LinearFormatSpec
Source§impl PartialEq for LinearFormatSpec
impl PartialEq for LinearFormatSpec
impl StructuralPartialEq for LinearFormatSpec
Auto Trait Implementations§
impl Freeze for LinearFormatSpec
impl RefUnwindSafe for LinearFormatSpec
impl Send for LinearFormatSpec
impl Sync for LinearFormatSpec
impl Unpin for LinearFormatSpec
impl UnsafeUnpin for LinearFormatSpec
impl UnwindSafe for LinearFormatSpec
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