pub struct MemoryAttentionCompiled {
pub n_img: usize,
pub max_n_mem: usize,
pub d_model: usize,
pub kv_in_dim: usize,
pub max_obj_ptr_tokens: usize,
/* private fields */
}Fields§
§n_img: usize§max_n_mem: usize§d_model: usize§kv_in_dim: usize§max_obj_ptr_tokens: usizeImplementations§
Source§impl MemoryAttentionCompiled
impl MemoryAttentionCompiled
pub fn compile( w: &Sam2MemoryAttentionWeights, n_img: usize, max_n_mem: usize, max_obj_ptr_tokens: usize, device: Device, ) -> Result<MemoryAttentionCompiled, Error>
pub fn compile_with_profile( w: &Sam2MemoryAttentionWeights, n_img: usize, max_n_mem: usize, max_obj_ptr_tokens: usize, device: Device, profile: &CompileProfile, ) -> Result<MemoryAttentionCompiled, Error>
Sourcepub fn compile_in_graph_rope(
w: &Sam2MemoryAttentionWeights,
n_img: usize,
max_n_mem: usize,
max_obj_ptr_tokens: usize,
device: Device,
) -> Result<MemoryAttentionCompiled, Error>
pub fn compile_in_graph_rope( w: &Sam2MemoryAttentionWeights, n_img: usize, max_n_mem: usize, max_obj_ptr_tokens: usize, device: Device, ) -> Result<MemoryAttentionCompiled, Error>
One compiled graph per layer (Op::AxialRope2d in-graph). Fusion is disabled
so FuseAttentionBlock cannot reorder RoPE relative to attention.
pub fn compile_in_graph_rope_with_profile( w: &Sam2MemoryAttentionWeights, n_img: usize, max_n_mem: usize, max_obj_ptr_tokens: usize, device: Device, profile: &CompileProfile, ) -> Result<MemoryAttentionCompiled, Error>
pub fn run( &mut self, curr: &[f32], curr_pos: &[f32], memory: &[f32], memory_pos: &[f32], active_n_mem: usize, num_obj_ptr_tokens: usize, ) -> Result<Vec<f32>, Error>
Auto Trait Implementations§
impl !RefUnwindSafe for MemoryAttentionCompiled
impl !Sync for MemoryAttentionCompiled
impl !UnwindSafe for MemoryAttentionCompiled
impl Freeze for MemoryAttentionCompiled
impl Send for MemoryAttentionCompiled
impl Unpin for MemoryAttentionCompiled
impl UnsafeUnpin for MemoryAttentionCompiled
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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>
Converts
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>
Converts
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