pub struct Mamba3SingleSsdCache {
pub ssm_bhpr: Tensor<4>,
pub k_state_bmhr: Tensor<4>,
pub v_state_bhp: Tensor<3>,
pub rotation: RotationState,
}Expand description
Mutable state for a single Mamba-3 layer running the single-ssd form algorithm.
Tensor shapes match Mamba3Cache. The semantic difference lives entirely
in ssm_bhpr (see the module-level documentation).
Fields§
§ssm_bhpr: Tensor<4>SingleSsd-form SSM accumulator h'ₜ.
Update rule: h'ₜ = αₜ h'ₜ₋₁ + scaleₜ · sumₘ Bₜ[m] ⊗ (xₜ ⊙ mimo_xₘ).
Different from Mamba3Cache::ssm_bhpr.
Shape: [batch, nheads, per_head_dim, state_rank]
k_state_bmhr: Tensor<4>Previous token’s K per mimo rank = post-RoPE, post-bias Bₜ₋₁[m].
Used at the start of the next forward_single_ssd call to seed the boundary β
contribution (1 − λ₀) · Δ₀ · Bₜ₋₁ ⊗ xₜ₋₁ (which the previous call could
not yet add because it did not know λ₀, Δ₀).
Shape: [batch, mimo_rank, nheads, state_rank]
v_state_bhp: Tensor<3>Previous token’s x = xₜ₋₁.
Paired with Self::k_state_bmhr to form the boundary β term.
Shape: [batch, nheads, per_head_dim]
rotation: RotationStateCumulative data-dependent rotation up to the current position
(RotationState).
Same role as in Mamba3Cache: continued across calls for streaming.
Carries the same value as the double-ssd cache’s field (the From impls
move it across), so the two caches still inter-convert by field identity.
Implementations§
Source§impl Mamba3SingleSsdCache
impl Mamba3SingleSsdCache
Sourcepub fn sanity(&self)
pub fn sanity(&self)
Run the NaN/Inf guards on every cached tensor.
Trait Implementations§
Source§impl AutodiffModule for Mamba3SingleSsdCache
impl AutodiffModule for Mamba3SingleSsdCache
Source§impl Clone for Mamba3SingleSsdCache
impl Clone for Mamba3SingleSsdCache
Source§impl Debug for Mamba3SingleSsdCache
impl Debug for Mamba3SingleSsdCache
Source§impl Display for Mamba3SingleSsdCache
impl Display for Mamba3SingleSsdCache
Source§impl From<Mamba3DoubleSsdCache> for Mamba3SingleSsdCache
impl From<Mamba3DoubleSsdCache> for Mamba3SingleSsdCache
Source§fn from(cache: Mamba3DoubleSsdCache) -> Self
fn from(cache: Mamba3DoubleSsdCache) -> Self
Source§impl From<Mamba3SingleSsdCache> for Mamba3Cache
impl From<Mamba3SingleSsdCache> for Mamba3Cache
Source§fn from(cache: Mamba3SingleSsdCache) -> Self
fn from(cache: Mamba3SingleSsdCache) -> Self
Source§impl From<Mamba3SingleSsdCache> for Mamba3DoubleSsdCache
impl From<Mamba3SingleSsdCache> for Mamba3DoubleSsdCache
Source§fn from(cache: Mamba3SingleSsdCache) -> Self
fn from(cache: Mamba3SingleSsdCache) -> Self
Source§impl Module for Mamba3SingleSsdCache
impl Module for Mamba3SingleSsdCache
Source§fn num_params(&self) -> usize
fn num_params(&self) -> usize
Source§fn visit<Visitor: ModuleVisitor>(&self, visitor: &mut Visitor)
fn visit<Visitor: ModuleVisitor>(&self, visitor: &mut Visitor)
Source§fn map<Mapper: ModuleMapper>(self, mapper: &mut Mapper) -> Self
fn map<Mapper: ModuleMapper>(self, mapper: &mut Mapper) -> Self
Source§fn collect_devices(&self, devices: Devices) -> Devices
fn collect_devices(&self, devices: Devices) -> Devices
Source§fn to_device(self, device: &Device) -> Self
fn to_device(self, device: &Device) -> Self
Source§fn fork(self, device: &Device) -> Self
fn fork(self, device: &Device) -> Self
§fn devices(&self) -> Vec<Device>
fn devices(&self) -> Vec<Device>
§fn freeze_group(self, group: ParamGroup) -> Self
fn freeze_group(self, group: ParamGroup) -> Self
require_grad to false for every parameter in the given group, leaving the rest
of the module untouched. Read more§fn unfreeze_group(self, group: ParamGroup) -> Self
fn unfreeze_group(self, group: ParamGroup) -> Self
require_grad to true for every parameter in the given group, leaving the rest
of the module untouched. Read more§fn train(self) -> Selfwhere
Self: AutodiffModule,
fn train(self) -> Selfwhere
Self: AutodiffModule,
§fn quantize_weights(self, quantizer: &mut Quantizer) -> Self
fn quantize_weights(self, quantizer: &mut Quantizer) -> Self
§fn quantize_weights_group(
self,
quantizer: &mut Quantizer,
group: ParamGroup,
) -> Self
fn quantize_weights_group( self, quantizer: &mut Quantizer, group: ParamGroup, ) -> Self
§fn apply_reparameterization<R>(self, reparameterizer: R) -> Selfwhere
Self: Sized,
R: Reparameterizer,
fn apply_reparameterization<R>(self, reparameterizer: R) -> Selfwhere
Self: Sized,
R: Reparameterizer,
Reparameterizer]. Read more§fn apply_lora(self, lora: Lora) -> Selfwhere
Self: Sized,
fn apply_lora(self, lora: Lora) -> Selfwhere
Self: Sized,
§fn apply_qlora(self, qlora: QLora) -> Selfwhere
Self: Sized,
fn apply_qlora(self, qlora: QLora) -> Selfwhere
Self: Sized,
§fn into_record(self) -> ModuleRecordwhere
Self: Sized,
fn into_record(self) -> ModuleRecordwhere
Self: Sized,
ModuleRecord. Read more§fn into_record_group(self, group: ParamGroup) -> ModuleRecordwhere
Self: Sized,
fn into_record_group(self, group: ParamGroup) -> ModuleRecordwhere
Self: Sized,
§fn try_load_record(self, record: ModuleRecord) -> Result<Self, RecordError>where
Self: Sized,
fn try_load_record(self, record: ModuleRecord) -> Result<Self, RecordError>where
Self: Sized,
ModuleRecord to this module, returning the loaded
module. Read more§fn load_record(self, record: ModuleRecord) -> Selfwhere
Self: Sized,
fn load_record(self, record: ModuleRecord) -> Selfwhere
Self: Sized,
ModuleRecord to this module, consuming and returning
it. Read more