bench/
bench.rs

1use tiny_ml::prelude::*;
2
3fn main() {
4    // let's check how fast this thing gets
5    let mut net: NeuralNetwork<1, 1> = NeuralNetwork::new()
6        .add_layer(5, ActivationFunction::ReLU)
7        .add_layer(5, ActivationFunction::ReLU)
8        .add_layer(5, ActivationFunction::ReLU)
9        .add_layer(5, ActivationFunction::ReLU)
10        .add_layer(5, ActivationFunction::ReLU)
11        .add_layer(5, ActivationFunction::ReLU)
12        .add_layer(1, ActivationFunction::Linear);
13
14    let mut sum = 0.0;
15    for i in 0..10_000_000 {
16        sum += net.run(&[i as f32])[0];
17    }
18
19    println!("{sum}");
20}