|
FlexNN 1
Fully connected neural network built from scratch with flexible n-layer design and multiple activations.
|
Type-erased wrapper for FlexNN::Layers — heterogeneous stack without inheritance. More...
#include <type_traits>#include <variant>#include "Dense.hpp"#include "Conv1D.hpp"#include "BatchNorm1D.hpp"#include "Pool1D.hpp"#include "activations/ActivationParameters.hpp"

Go to the source code of this file.
Classes | |
| class | FlexNN::Layers::Layer |
| Type-erased layer — holds one concrete layer type. More... | |
Namespaces | |
| namespace | FlexNN |
| Namespace for the FlexNN neural network library. | |
| namespace | FlexNN::Layers |
Type-erased wrapper for FlexNN::Layers — heterogeneous stack without inheritance.
Each concrete layer (Dense, Conv1D, BatchNorm1D, MaxPool1D, AvgPool1D) lives in its own header (include/layers/<Type>.hpp) and owns its weights. FlexNN::Layers::Layer is a thin wrapper over std::variant that lets FlexNN::NeuralNetwork hold a vector<Layer> of mixed types while keeping dispatch std::visit (no vtable, no heap, inline). New layer types are added by expanding the variant in later PRs — existing visit sites (forward/backward in NeuralNetwork, ModelIO) automatically handle them via the same pattern without touching old concrete headers.
Why variant, not inheritance (see LLD_FLEXNN §3):
std::visit is optimized away