mod attention;
mod early_exit;
mod restriction;
mod router;
mod sparse;
pub use attention::{SheafAttention, SheafAttentionConfig};
pub use early_exit::{
process_with_early_exit, EarlyExit, EarlyExitConfig, EarlyExitResult, EarlyExitStatistics,
ExitReason,
};
pub use restriction::{RestrictionMap, RestrictionMapConfig};
pub use router::{ComputeLane, LaneStatistics, RoutingDecision, TokenRouter, TokenRouterConfig};
pub use sparse::{
ResidualSparseMask, SparseResidualAttention, SparseResidualConfig, SparsityStatistics,
};
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_module_exports() {
let config = SheafAttentionConfig::default();
assert!(config.beta > 0.0);
let rmap_config = RestrictionMapConfig::default();
assert!(rmap_config.input_dim > 0);
let router_config = TokenRouterConfig::default();
assert!(router_config.theta_reflex > 0.0);
let early_exit_config = EarlyExitConfig::default();
assert!(early_exit_config.epsilon > 0.0);
let sparse_config = SparseResidualConfig::default();
assert!(sparse_config.residual_threshold > 0.0);
}
#[test]
fn test_compute_lane_ordering() {
assert!(ComputeLane::Reflex < ComputeLane::Standard);
assert!(ComputeLane::Standard < ComputeLane::Deep);
assert!(ComputeLane::Deep < ComputeLane::Escalate);
}
}