pub struct ReadoutNeuron {
pub membrane: i32,
pub kappa: i16,
}alloc only.Expand description
Non-spiking leaky integrator readout neuron.
The readout accumulates weighted spike inputs with exponential decay. Its membrane potential (i32 for extra precision) is the network’s continuous output.
§Precision
While hidden layer neurons use i16 membranes, the readout uses i32 to
prevent overflow during long sequences. The decay factor kappa is
still Q1.14 (i16), but the membrane has ~18 bits of headroom above
the Q1.14 range.
Fields§
§membrane: i32Membrane potential (higher precision accumulator). Stored in Q1.14-compatible scale but with i32 range.
kappa: i16Decay factor in Q1.14 (controls how fast past inputs are forgotten).
Implementations§
Source§impl ReadoutNeuron
impl ReadoutNeuron
Sourcepub fn new(kappa: i16) -> Self
pub fn new(kappa: i16) -> Self
Create a new readout neuron with the given decay factor.
§Arguments
kappa– decay factor in Q1.14 (0 = no memory, Q14_ONE = perfect memory)
Sourcepub fn step(&mut self, weighted_input: i32)
pub fn step(&mut self, weighted_input: i32)
Advance the readout by one timestep.
Decays the membrane potential and integrates new weighted input:
membrane = (membrane * kappa) >> 14 + weighted_input§Arguments
weighted_input– sum ofW_kj * z_j[t]for active spikes, as i32
Sourcepub fn output_i32(&self) -> i32
pub fn output_i32(&self) -> i32
Get the raw membrane potential as i32.
Sourcepub fn output_f64(&self, scale: f64) -> f64
pub fn output_f64(&self, scale: f64) -> f64
Dequantize the membrane potential to f64.
§Arguments
scale– output scaling factor (typically1.0 / Q14_ONE as f64)