#[non_exhaustive]pub enum Precision {
Float,
Fixed,
}alloc only.Expand description
Compute precision for SNN weight and activation storage.
Controls whether the network operates in floating-point or fixed-point mode. The default is platform-dependent:
-
When
stdis available (desktop / server),Float(f32) is the default. f32 offers fast IEEE-754 arithmetic and is sufficient for online learning workloads where weights are updated continuously. -
When
stdis absent (cortex_m / bare-metalno_std),Fixed(Q1.14 i16) is the default. Fixed-point is mandatory on Cortex-M0+ and RISC-V parts without FPU hardware; it also reduces SRAM footprint by 2x versus f32 (2 bytes vs 4 per weight).
This is a principled default, not an arbitrary one: the selection criterion is memory budget and FPU availability, both of which are unambiguous at compile time. A desktop build never needs the 2x SRAM saving; a bare-metal build never has a hardware FPU to benefit from.
§Note on Current State
SpikeNetFixed unconditionally uses Q1.14 arithmetic at the compute level.
This enum documents the intended precision and is used as a config field for
future path selection. Selecting Precision::Float on a std build
currently behaves identically to Precision::Fixed (the fixed-point
kernel is always used). When an f32 kernel lands, Float will activate it.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Float
32-bit IEEE-754 floating-point. Default on std targets.
Best for: desktop / server workloads with hardware FPU.
Fixed
Q1.14 fixed-point (i16). Default on no_std / cortex_m targets.
Best for: microcontrollers without FPU, minimum SRAM footprint.
Trait Implementations§
impl Copy for Precision
impl Eq for Precision
impl StructuralPartialEq for Precision
Auto Trait Implementations§
impl Freeze for Precision
impl RefUnwindSafe for Precision
impl Send for Precision
impl Sync for Precision
impl Unpin for Precision
impl UnsafeUnpin for Precision
impl UnwindSafe for Precision
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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>
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