use astrai::prelude::*; use criterion::{black_box, criterion_group, criterion_main, Criterion}; use rand::Rng; extern crate blas_src; pub fn criterion_benchmark(c: &mut Criterion) { let mut network = Network::new(64, 1, Some(vec![32, 16, 8, 4, 2]), None); network.all_connect(); let mut group = c.benchmark_group("activations"); let mut rng = rand::thread_rng(); let input: Vec = vec![rng.gen_bool(0.5) as u8 as f64; 64]; group.bench_function("matrix activation", |b| { b.iter(|| network.activate(black_box(input.clone()), false)) }); group.bench_function("matrix activation with backprop enabled", |b| { b.iter(|| network.activate(black_box(input.clone()), true)) }); group.finish(); } criterion_group!(benches, criterion_benchmark); criterion_main!(benches);