pub struct Mamba1CacheConfig {
pub batch: usize,
pub state_rank: usize,
pub conv_kernel: usize,
pub d_inner: usize,
}Expand description
Configuration / factory for a single Mamba1Cache.
Fields§
§batch: usizeBatch size.
state_rank: usizeState rank — the latent dimension of the SSM hidden state.
Corresponds to state_rank in Mamba1Config.
conv_kernel: usizeCausal convolution window length. Corresponds to conv_kernel in
Mamba1Config.
d_inner: usizeInner (expanded) channel width d_inner.
Implementations§
Source§impl Mamba1CacheConfig
impl Mamba1CacheConfig
Sourcepub fn new(batch: usize, d_inner: usize) -> Self
pub fn new(batch: usize, d_inner: usize) -> Self
Create a new instance of the config.
§Arguments
§Required Arguments
§batch
Batch size.
§d_inner
Inner (expanded) channel width d_inner.
§Default Arguments
§state_rank
State rank — the latent dimension of the SSM hidden state.
Corresponds to state_rank in Mamba1Config.
- Defaults to
16
§conv_kernel
Causal convolution window length. Corresponds to conv_kernel in
Mamba1Config.
- Defaults to
4
Source§impl Mamba1CacheConfig
impl Mamba1CacheConfig
Sourcepub fn with_state_rank(self, state_rank: usize) -> Self
pub fn with_state_rank(self, state_rank: usize) -> Self
Sets the value for the field state_rank.
State rank — the latent dimension of the SSM hidden state.
Corresponds to state_rank in Mamba1Config.
- Defaults to
16
Sourcepub fn with_conv_kernel(self, conv_kernel: usize) -> Self
pub fn with_conv_kernel(self, conv_kernel: usize) -> Self
Sets the value for the field conv_kernel.
Causal convolution window length. Corresponds to conv_kernel in
Mamba1Config.
- Defaults to
4
Source§impl Mamba1CacheConfig
impl Mamba1CacheConfig
Sourcepub fn new_from_block_config(batch: usize, block_config: Mamba1Config) -> Self
pub fn new_from_block_config(batch: usize, block_config: Mamba1Config) -> Self
Derive cache shapes from a Mamba-1 block configuration plus a batch size.
Sourcepub fn init(&self, device: &Device) -> Mamba1Cache
pub fn init(&self, device: &Device) -> Mamba1Cache
Allocate zero-initialised cache tensors on device.
Zero initialisation is correct because the convolution window represents
“no previous tokens” (identity padding) and the SSM state represents the
standard zero initial condition h₀ = 0.