pub struct Mamba1Cache {
pub conv_bik: Tensor<3>,
pub ssm_bir: Tensor<3>,
}Expand description
The mutable state carried between calls for a single Mamba-1 layer.
Fields§
§conv_bik: Tensor<3>Convolution rolling window.
The last conv_kernel feature vectors fed into the depthwise Conv1d.
At each step the oldest column is dropped and the new token’s projection
is appended on the right, maintaining strict causality.
Shape: [batch, d_inner, conv_kernel]
ssm_bir: Tensor<3>SSM hidden state.
The O(d_inner·state_rank) compressed summary of all tokens seen so far, updated by the selective-scan recurrence at each step.
Shape: [batch, d_inner, state_rank]
Implementations§
Source§impl Mamba1Cache
impl Mamba1Cache
Sourcepub fn sanity(&self)
pub fn sanity(&self)
Run the NaN/Inf guards on every cached tensor.
Trait Implementations§
Source§impl AutodiffModule for Mamba1Cache
impl AutodiffModule for Mamba1Cache
Source§impl Clone for Mamba1Cache
impl Clone for Mamba1Cache
Source§impl Debug for Mamba1Cache
impl Debug for Mamba1Cache
Source§impl Display for Mamba1Cache
impl Display for Mamba1Cache
Source§impl Module for Mamba1Cache
impl Module for Mamba1Cache
Source§fn num_params(&self) -> usize
fn num_params(&self) -> usize
Get the number of parameters the module has, including all of its sub-modules.
Source§fn visit<Visitor: ModuleVisitor>(&self, visitor: &mut Visitor)
fn visit<Visitor: ModuleVisitor>(&self, visitor: &mut Visitor)
Visit each tensor parameter in the module with a visitor.
Source§fn map<Mapper: ModuleMapper>(self, mapper: &mut Mapper) -> Self
fn map<Mapper: ModuleMapper>(self, mapper: &mut Mapper) -> Self
Map each tensor parameter in the module with a mapper.
Source§fn collect_devices(&self, devices: Devices) -> Devices
fn collect_devices(&self, devices: Devices) -> Devices
Return all the devices found in the underneath module tree added to the given vector
without duplicates.
Source§fn to_device(self, device: &Device) -> Self
fn to_device(self, device: &Device) -> Self
Move the module and all of its sub-modules to the given device. Read more
Source§fn fork(self, device: &Device) -> Self
fn fork(self, device: &Device) -> Self
Fork the module and all of its sub-modules to the given device. Read more
§fn devices(&self) -> Vec<Device>
fn devices(&self) -> Vec<Device>
Return all the devices found in the underneath module tree without duplicates.
§fn train(self) -> Selfwhere
Self: AutodiffModule,
fn train(self) -> Selfwhere
Self: AutodiffModule,
Move the module and all of its sub-modules to the autodiff backend. Read more
§fn quantize_weights(self, quantizer: &mut Quantizer) -> Self
fn quantize_weights(self, quantizer: &mut Quantizer) -> Self
Quantize the weights of the module.
§fn into_record(self) -> ModuleRecordwhere
Self: Sized,
fn into_record(self) -> ModuleRecordwhere
Self: Sized,
Collect this module’s parameters into a
ModuleRecord. Read more§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,
Apply a
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,
Apply a
ModuleRecord to this module, consuming and returning
it. Read moreSource§impl ModuleDisplay for Mamba1Cache
impl ModuleDisplay for Mamba1Cache
§fn format(&self, passed_settings: DisplaySettings) -> String
fn format(&self, passed_settings: DisplaySettings) -> String
Formats the module with provided display settings. Read more
§fn custom_settings(&self) -> Option<DisplaySettings>
fn custom_settings(&self) -> Option<DisplaySettings>
Custom display settings for the module. Read more
§fn custom_content(&self, _content: Content) -> Option<Content>
fn custom_content(&self, _content: Content) -> Option<Content>
Custom attributes for the module. Read more
Auto Trait Implementations§
impl Freeze for Mamba1Cache
impl RefUnwindSafe for Mamba1Cache
impl Send for Mamba1Cache
impl Sync for Mamba1Cache
impl Unpin for Mamba1Cache
impl UnsafeUnpin for Mamba1Cache
impl UnwindSafe for Mamba1Cache
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