1pub mod attention;
44pub mod config;
45pub mod error;
46pub mod graph;
47pub mod hyperbolic;
48pub mod moe;
49pub mod sdk;
50pub mod sparse;
51pub mod training;
52pub mod traits;
53pub mod utils;
54
55pub mod curvature;
57pub mod topology;
58pub mod transport;
59
60pub mod info_bottleneck;
62pub mod info_geometry;
63pub mod pde_attention;
64pub mod unified_report;
65
66#[cfg(feature = "sheaf")]
68pub mod sheaf;
69
70pub use attention::{MultiHeadAttention, ScaledDotProductAttention};
72pub use config::{AttentionConfig, GraphAttentionConfig, SparseAttentionConfig};
73pub use error::{AttentionError, AttentionResult};
74pub use hyperbolic::{
75 exp_map, log_map, mobius_add, poincare_distance, project_to_ball, HyperbolicAttention,
76 HyperbolicAttentionConfig, MixedCurvatureAttention, MixedCurvatureConfig,
77};
78pub use traits::{
79 Attention, EdgeInfo, GeometricAttention, Gradients, GraphAttention, SparseAttention,
80 SparseMask, TrainableAttention,
81};
82
83pub use sparse::{
85 AttentionMask, FlashAttention, LinearAttention, LocalGlobalAttention, SparseMaskBuilder,
86};
87
88pub use moe::{
90 Expert, ExpertType, HyperbolicExpert, LearnedRouter, LinearExpert, MoEAttention, MoEConfig,
91 Router, StandardExpert, TopKRouting,
92};
93
94pub use graph::{
96 DualSpaceAttention, DualSpaceConfig, EdgeFeaturedAttention, EdgeFeaturedConfig, GraphRoPE,
97 RoPEConfig,
98};
99
100pub use training::{
102 Adam, AdamW, CurriculumScheduler, CurriculumStage, DecayType, HardNegativeMiner, InfoNCELoss,
103 LocalContrastiveLoss, Loss, MiningStrategy, NegativeMiner, Optimizer, Reduction,
104 SpectralRegularization, TemperatureAnnealing, SGD,
105};
106
107pub use sdk::{presets, AttentionBuilder, AttentionPipeline};
109
110pub use transport::{
112 CentroidCache, CentroidOTAttention, CentroidOTConfig, ProjectionCache,
113 SlicedWassersteinAttention, SlicedWassersteinConfig, WindowCache,
114};
115
116pub use curvature::{
118 ComponentQuantizer, FusedCurvatureConfig, MixedCurvatureCache, MixedCurvatureFusedAttention,
119 QuantizationConfig, QuantizedVector, TangentSpaceConfig, TangentSpaceMapper,
120};
121
122pub use topology::{
124 AttentionMode, AttentionPolicy, CoherenceMetric, PolicyConfig, TopologyGatedAttention,
125 TopologyGatedConfig, WindowCoherence,
126};
127
128pub use info_geometry::{FisherConfig, FisherMetric, NaturalGradient, NaturalGradientConfig};
130
131pub use info_bottleneck::{DiagonalGaussian, IBConfig, InformationBottleneck, KLDivergence};
133
134pub use pde_attention::{DiffusionAttention, DiffusionConfig, GraphLaplacian, LaplacianType};
136
137#[cfg(feature = "sheaf")]
139pub use sheaf::{
140 process_with_early_exit, ComputeLane, EarlyExit, EarlyExitConfig, EarlyExitResult,
141 EarlyExitStatistics, ExitReason, LaneStatistics, ResidualSparseMask, RestrictionMap,
142 RestrictionMapConfig, RoutingDecision, SheafAttention, SheafAttentionConfig,
143 SparseResidualAttention, SparseResidualConfig, SparsityStatistics, TokenRouter,
144 TokenRouterConfig,
145};
146
147pub use unified_report::{
149 AttentionRecommendation, GeometryReport, MetricType, MetricValue, ReportBuilder, ReportConfig,
150};
151
152pub const VERSION: &str = env!("CARGO_PKG_VERSION");
154
155#[cfg(test)]
156mod tests {
157 use super::*;
158
159 #[test]
160 fn test_version() {
161 assert!(!VERSION.is_empty());
162 }
163
164 #[test]
165 fn test_basic_attention_workflow() {
166 let config = AttentionConfig::builder()
167 .dim(64)
168 .num_heads(4)
169 .build()
170 .unwrap();
171
172 assert_eq!(config.dim, 64);
173 assert_eq!(config.num_heads, 4);
174 assert_eq!(config.head_dim(), 16);
175 }
176}