Skip to main content

SSMLayer

Trait SSMLayer 

Source
pub trait SSMLayer: Send + Sync {
    // Required methods
    fn forward(&mut self, input: &[f64]) -> Vec<f64>;
    fn state(&self) -> &[f64];
    fn output_dim(&self) -> usize;
    fn reset(&mut self);
}
Available on crate feature alloc only.
Expand description

Trait for SSM layers that process sequential data one timestep at a time.

Implementors maintain internal hidden state that evolves with each call to forward. The hidden state captures temporal patterns from the input sequence without requiring storage of past observations.

§Thread Safety

All SSM layers are Send + Sync, enabling use in async pipelines and parallel prediction contexts.

Required Methods§

Source

fn forward(&mut self, input: &[f64]) -> Vec<f64>

Process one input timestep and return the output vector.

This advances the internal hidden state by one step. The output dimension equals the input dimension for selective SSMs, or 1 for scalar diagonal SSMs.

§Arguments
  • input – feature vector for this timestep
Source

fn state(&self) -> &[f64]

Get a reference to the current hidden state.

Source

fn output_dim(&self) -> usize

Output dimension of this SSM layer.

Source

fn reset(&mut self)

Reset hidden state to zeros, as if no data has been seen.

Implementors§