Modules
AodhML organizes code into modules. Each file is a module, and directories can form module hierarchies.
Importing Modules
// Import the entire module
import "std:io"
import "std:tensor"
// Import specific items
import "std:math" { sqrt, pow, PI }
// Import with alias
import "std:tensor" as T
let t = T.Tensor::zeros([3, 3])
Module Structure
// math.aodh
pub fn add(a: f64, b: f64) -> f64 {
return a + b
}
pub fn subtract(a: f64, b: f64) -> f64 {
return a - b
}
// Private function (not exported)
fn helper() -> i32 {
return 42
}
Using Imports
// main.aodh
import "math"
fn main() {
let result = math.add(3.0, 4.0)
println(result) // 7.0
}
Standard Library Modules
| Module | Description |
|---|---|
std:io | Input/output operations |
std:math | Mathematical functions |
std:tensor | Tensor operations |
std:nn | Neural network primitives |
std:optim | Optimizers |
std:dataset | Dataset loading |