pub struct SelectiveSSM { /* private fields */ }Available on crate feature
alloc only.Expand description
Mamba-style selective state space model.
The selective mechanism computes input-dependent B, C, and Delta at each timestep, enabling the model to dynamically control what information is stored in and retrieved from the hidden state.
§Dimensions
d_in– input/output dimension (number of channels)n_state– hidden state dimension per channel (N)- Total hidden state size:
d_in * n_state
§Weight Shapes
| Weight | Shape | Purpose |
|---|---|---|
w_delta | d_in | Projects input to scalar step size |
w_b | N x d_in | Projects input to state-input coupling |
w_c | N x d_in | Projects input to state-output coupling |
d_skip | d_in | Skip connection weights |
log_a | N | Fixed state transition (always negative after exp) |
§Example
use irithyll_core::ssm::selective::SelectiveSSM;
use irithyll_core::ssm::SSMLayer;
let mut ssm = SelectiveSSM::new(4, 8, 42);
let output = ssm.forward(&[1.0, 2.0, 3.0, 4.0]);
assert_eq!(output.len(), 4);Implementations§
Source§impl SelectiveSSM
impl SelectiveSSM
Sourcepub fn new(d_in: usize, n_state: usize, seed: u64) -> Self
pub fn new(d_in: usize, n_state: usize, seed: u64) -> Self
Create a new selective SSM with random weight initialization.
Weights are initialized from a small normal distribution (scale 0.01) using the provided seed for reproducibility. A is initialized via the Mamba strategy (A_n = -(n+1)).
§Arguments
d_in– input/output dimension (number of channels)n_state– hidden state dimension per channel (N)seed– random seed for weight initialization
§Example
use irithyll_core::ssm::selective::SelectiveSSM;
let ssm = SelectiveSSM::new(4, 16, 42);Trait Implementations§
Auto Trait Implementations§
impl Freeze for SelectiveSSM
impl RefUnwindSafe for SelectiveSSM
impl Send for SelectiveSSM
impl Sync for SelectiveSSM
impl Unpin for SelectiveSSM
impl UnsafeUnpin for SelectiveSSM
impl UnwindSafe for SelectiveSSM
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
Mutably borrows from an owned value. Read more