Skip to main content

ReadoutNeuron

Struct ReadoutNeuron 

Source
pub struct ReadoutNeuron {
    pub membrane: i32,
    pub kappa: i16,
}
Available on crate feature 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: i32

Membrane potential (higher precision accumulator). Stored in Q1.14-compatible scale but with i32 range.

§kappa: i16

Decay factor in Q1.14 (controls how fast past inputs are forgotten).

Implementations§

Source§

impl ReadoutNeuron

Source

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)
Source

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 of W_kj * z_j[t] for active spikes, as i32
Source

pub fn output_i32(&self) -> i32

Get the raw membrane potential as i32.

Source

pub fn output_f64(&self, scale: f64) -> f64

Dequantize the membrane potential to f64.

§Arguments
  • scale – output scaling factor (typically 1.0 / Q14_ONE as f64)
Source

pub fn reset(&mut self)

Reset the membrane potential to zero.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.