boxmot.segmentors.exporters.edgetam.attention
Exportable attention with real rotary arithmetic and explicit memory masks.
ExportAttention
Bases: Module
Reuse trained SAM projections without CUDA context managers during export.
forward
Apply scaled dot product attention with unchanged learned projections.
RotaryAttention
RotaryAttention(
source: Any,
*,
image_size: int,
memory_slots: int = 0,
tokens_per_memory: int = 0,
)
MemoryAttentionLayer
Bases: Module
Preserve an official memory layer while masking absent history entries.
cross_attention
instance-attribute
cross_attention = RotaryAttention(
cross_attn_image,
image_size=image_size,
memory_slots=memory_slots,
tokens_per_memory=tokens_per_memory,
)
self_attention
instance-attribute
self_attention = RotaryAttention(
self_attn, image_size=image_size
)
MemoryAttention
Bases: Module
Batch-first memory attention accepting masked, fixed-capacity histories.
layers
instance-attribute
layers = ModuleList(
(
MemoryAttentionLayer(
layer,
image_size=image_size,
memory_slots=memory_slots,
tokens_per_memory=tokens_per_memory,
)
)
for layer in (layers)
)
attend
Evaluate attention in query blocks to bound the eager attention workspace.