pub struct Sam2MemoryConfig {Show 16 fields
pub d_model: usize,
pub num_layers: usize,
pub num_heads: usize,
pub dim_feedforward: usize,
pub layer_norm_eps: f64,
pub kv_in_dim: usize,
pub rope_theta: f32,
pub rope_feat_size: [usize; 2],
pub rope_k_repeat: bool,
pub pos_enc_at_input: bool,
pub pos_enc_at_attn: bool,
pub pos_enc_at_cross_attn_keys: bool,
pub pos_enc_at_cross_attn_queries: bool,
pub max_obj_ptrs_in_encoder: usize,
pub mem_attn_in_graph_rope: bool,
pub mem_dim: usize,
}Expand description
Memory-attention configuration (video path).
d_model (256) is the working dim of memory-attention layers;
memory bank tokens come in at kv_in_dim=out_dim of the memory
encoder (64 in published configs) and are projected up by the
cross-attention’s k/v linear layers.
Fields§
§d_model: usize§num_layers: usize§num_heads: usize§dim_feedforward: usize§layer_norm_eps: f64§kv_in_dim: usizeMemory bank kv channel dim — matches memory-encoder out_dim.
rope_theta: f32§rope_feat_size: [usize; 2]Spatial size used to build the RoPE table for the image features (32×32 for the stride-32 path in published configs).
rope_k_repeat: bool§pos_enc_at_input: boolWhether to add the input PE to the queries at layer input
(pos_enc_at_input in the reference YAML; true).
pos_enc_at_attn: bool§pos_enc_at_cross_attn_keys: bool§pos_enc_at_cross_attn_queries: bool§max_obj_ptrs_in_encoder: usizeMaximum number of object pointers preserved across frames.
mem_attn_in_graph_rope: boolFuse each memory-attention layer into one graph with [Op::AxialRope2d]
(faster than the default five-graph + host-RoPE path). Requires axial RoPE
on the compile device (CPU today; Metal uses host fallback when enabled).
mem_dim: usizeNumber of temporal-position embeddings packed with each object-pointer token. Reference YAML: 64.
Trait Implementations§
Source§impl Clone for Sam2MemoryConfig
impl Clone for Sam2MemoryConfig
Source§fn clone(&self) -> Sam2MemoryConfig
fn clone(&self) -> Sam2MemoryConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for Sam2MemoryConfig
impl Debug for Sam2MemoryConfig
Source§impl Default for Sam2MemoryConfig
impl Default for Sam2MemoryConfig
Source§fn default() -> Sam2MemoryConfig
fn default() -> Sam2MemoryConfig
Auto Trait Implementations§
impl Freeze for Sam2MemoryConfig
impl RefUnwindSafe for Sam2MemoryConfig
impl Send for Sam2MemoryConfig
impl Sync for Sam2MemoryConfig
impl Unpin for Sam2MemoryConfig
impl UnsafeUnpin for Sam2MemoryConfig
impl UnwindSafe for Sam2MemoryConfig
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more