Skip to main content

nam_rs/models/convnet/
mod.rs

1// SPDX-License-Identifier: Apache-2.0
2// Copyright (c) 2026 Fábio Henrique de Lima Silva (fhl.bsb@gmail.com) All rights reserved.
3
4//! ConvNet feed-forward architecture (F4).
5//!
6//! Layers: Conv1D → BatchNorm → Activation, chained sequentially
7//! with an optional post-stack head.
8
9pub mod batch_norm;
10pub mod block;
11pub mod model;
12
13pub use batch_norm::BatchNorm1D;
14pub use block::ConvNetBlock;
15pub use model::{ConvNetModel, LinearHead};
16
17use super::NamModel;
18use super::sealed;
19
20impl sealed::Sealed for ConvNetModel {}
21
22impl NamModel for ConvNetModel {
23    fn process(&mut self, input: &[f32], output: &mut [f32]) {
24        self.process(input, output);
25    }
26
27    fn prewarm(&mut self, _num_samples: usize) {
28        self.prewarm();
29    }
30
31    fn prewarm_samples(&self) -> usize {
32        self.receptive_field_size
33    }
34
35    fn set_max_buffer_size(&mut self, _max_buf: usize) -> anyhow::Result<()> {
36        Ok(())
37    }
38
39    fn prewarm_on_reset(&self) -> bool {
40        self.prewarm_on_reset
41    }
42
43    fn set_prewarm_on_reset(&mut self, val: bool) {
44        self.prewarm_on_reset = val;
45    }
46}