|
FlexNN 1
Fully connected neural network built from scratch with flexible n-layer design and multiple activations.
|
Public activation enum and helpers for FlexNN. More...
#include <cstdint>#include <string_view>#include <type_traits>#include <Eigen/Dense>#include "ActivationParameters.hpp"

Go to the source code of this file.
Namespaces | |
| namespace | FlexNN |
| Namespace for the FlexNN neural network library. | |
| namespace | FlexNN::Activations |
| namespace | FlexNN::Activations::detail |
Enumerations | |
| enum class | FlexNN::Activations::Activation : uint8_t { FlexNN::Activations::None = 0 , FlexNN::Activations::ReLU = 1 , FlexNN::Activations::LeakyReLU = 2 , FlexNN::Activations::Sigmoid = 3 , FlexNN::Activations::Tanh = 4 , FlexNN::Activations::Softmax = 5 } |
| Activation function identifier. More... | |
Functions | |
| const char * | FlexNN::Activations::to_string (Activation a) noexcept |
| Convert Activation to canonical lower-case string. | |
| bool | FlexNN::Activations::try_parse (std::string_view s, Activation &out) noexcept |
| Parse a string into an Activation. | |
| Eigen::MatrixXd | FlexNN::Activations::detail::forward (Activation act, const Eigen::MatrixXd &Z, const ActivationParameters ¶ms=ActivationParameters{}) |
| Elementwise forward for a single activation. | |
| Eigen::MatrixXd | FlexNN::Activations::detail::backward (Activation act, const Eigen::MatrixXd &dA, const Eigen::MatrixXd &Z, const Eigen::MatrixXd &A, const ActivationParameters ¶ms=ActivationParameters{}) noexcept |
| Elementwise backward for a single activation (hidden layers). | |
| Eigen::MatrixXd | FlexNN::Activations::detail::softmax_forward (const Eigen::MatrixXd &Z) |
| Stable column-wise softmax forward. | |
| Eigen::MatrixXd | FlexNN::Activations::detail::softmax_backward_hidden (const Eigen::MatrixXd &s, const Eigen::MatrixXd &upstream) noexcept |
Softmax hidden backward: dZ = J * upstream per column. | |
Public activation enum and helpers for FlexNN.
Defines the type-safe FlexNN::Activations::Activation enum that replaces the old stringly-typed std::string activationFunction. The enum is 1 byte (uint8_t) so it maps directly to the model.bin flat binary (see LLD_FLEXNN §7 / Appendix A). Per-activation elementwise ops live in include/activations (e.g., ReLU.hpp) and are re-exported via FlexNN::Activations::detail for use by lib/layers.
Why this file exists:
-Wswitch-enum exhaustiveness: adding a new Activation forces updates to every switch without a default branch.Activation.hpp) without pulling all per-activation headers unless needed.