|
FlexNN 1
Fully connected neural network built from scratch with flexible n-layer design and multiple activations.
|
Namespaces | |
| namespace | detail |
Classes | |
| struct | ActivationParameters |
| Hyperparameters for activations. More... | |
Enumerations | |
| enum class | Activation : uint8_t { None = 0 , ReLU = 1 , LeakyReLU = 2 , Sigmoid = 3 , Tanh = 4 , Softmax = 5 } |
| Activation function identifier. More... | |
Functions | |
| const char * | to_string (Activation a) noexcept |
| Convert Activation to canonical lower-case string. | |
| bool | try_parse (std::string_view s, Activation &out) noexcept |
| Parse a string into an Activation. | |
Variables | |
| constexpr double | kDefaultLeakyAlpha = 0.01 |
| Default slope for LeakyReLU negative side (matches LLD_FLEXNN §4, v0.1). | |
|
strong |
Activation function identifier.
Values are stable on-wire (model.bin) — do not reorder. 0 is linear (pre-BatchNorm or debugging). LeakyReLU alpha is configurable per-layer via ActivationParameters (default 0.01, see ActivationParameters.hpp); model.bin v2 stores it as 1 float32 in aux when act==LeakyReLU.
| Enumerator | |
|---|---|
| None | Linear, no activation. |
| ReLU | max(0, z) |
| LeakyReLU | z>0 ? z : alpha*z (alpha from ActivationParameters) |
| Sigmoid | 1/(1+exp(-z)), clamped |
| Tanh | std::tanh(z) |
| Softmax | Stable col-wise softmax — only on last layer in v0.1. |
|
noexcept |
Convert Activation to canonical lower-case string.
| a | Activation value |
|
noexcept |
Parse a string into an Activation.
Case-insensitive, trims ASCII whitespace. Accepts canonical names ("relu", "leaky_relu", "leakyrelu", "sigmoid", "tanh", "softmax", "none") and common aliases ("leaky-relu", "lrelu", "linear" for None). Returns false on unknown input without throwing — caller decides whether to treat as None or error.
| s | Input view (not null-terminated required) |
| out | Output activation on success |
|
inlineconstexpr |
Default slope for LeakyReLU negative side (matches LLD_FLEXNN §4, v0.1).