pub struct SpikeNetFixed { /* private fields */ }alloc only.Expand description
Complete spiking neural network with e-prop online learning.
Manages all neuron state, synaptic weights, eligibility traces, and spike
encoding. After construction, memory is fixed – no further allocations
occur during forward or train_step.
§Thread Safety
SpikeNetFixed is Send + Sync because it contains only Vec<T> and
primitive fields with no interior mutability.
Implementations§
Source§impl SpikeNetFixed
impl SpikeNetFixed
Sourcepub fn new(config: SpikeNetFixedConfig) -> Self
pub fn new(config: SpikeNetFixedConfig) -> Self
Create a new SpikeNetFixed with the given configuration.
Allocates all internal buffers and initializes weights from the PRNG. No further allocations occur during operation.
Sourcepub fn forward(&mut self, input_i16: &[i16])
pub fn forward(&mut self, input_i16: &[i16])
Run one forward timestep without learning.
Encodes input into spikes, updates hidden neuron states, and advances the readout. Does NOT update weights or eligibility traces.
§Arguments
input_i16– raw input features in Q1.14, length must equalconfig.n_input
Sourcepub fn train_step(&mut self, input_i16: &[i16], target_i16: &[i16])
pub fn train_step(&mut self, input_i16: &[i16], target_i16: &[i16])
Run one forward + learning timestep (e-prop three-factor rule).
Performs a forward pass, then computes error signals and updates all weights using the e-prop learning rule.
§Arguments
input_i16– raw input features in Q1.14target_i16– target values in Q1.14, length must equalconfig.n_output
Sourcepub fn predict_raw(&self) -> Vec<i32>
pub fn predict_raw(&self) -> Vec<i32>
Get raw readout membrane potentials as i32.
Returns a reference to an internal buffer that is updated on each
forward or train_step call.
Sourcepub fn predict_f64(&self, output_scale: f64) -> f64
pub fn predict_f64(&self, output_scale: f64) -> f64
Get the first readout’s membrane potential, dequantized to f64.
§Arguments
output_scale– scaling factor (typically1.0 / Q14_ONE as f64)
Sourcepub fn predict_all_f64(&self, output_scale: f64) -> Vec<f64>
pub fn predict_all_f64(&self, output_scale: f64) -> Vec<f64>
Get all readout membrane potentials, dequantized to f64.
§Arguments
output_scale– scaling factor per output
Sourcepub fn n_samples_seen(&self) -> u64
pub fn n_samples_seen(&self) -> u64
Number of training samples seen.
Sourcepub fn config(&self) -> &SpikeNetFixedConfig
pub fn config(&self) -> &SpikeNetFixedConfig
Reference to the network configuration.
Number of hidden neurons.
Sourcepub fn n_input_encoded(&self) -> usize
pub fn n_input_encoded(&self) -> usize
Number of encoded input channels (2 * n_input).
Get current hidden spike vector.
Get current hidden membrane potentials.
Sourcepub fn memory_bytes(&self) -> usize
pub fn memory_bytes(&self) -> usize
Compute total memory usage in bytes.
Counts all Vec contents plus struct overhead.
Trait Implementations§
impl Send for SpikeNetFixed
impl Sync for SpikeNetFixed
Auto Trait Implementations§
impl Freeze for SpikeNetFixed
impl RefUnwindSafe for SpikeNetFixed
impl Unpin for SpikeNetFixed
impl UnsafeUnpin for SpikeNetFixed
impl UnwindSafe for SpikeNetFixed
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> 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