49static_assert(
sizeof(
Activation) == 1,
"Activation must be 1 byte for model.bin encoding");
50static_assert(std::is_same_v<std::underlying_type_t<Activation>, uint8_t>,
51 "Activation underlying type must be uint8_t");
118 const Eigen::MatrixXd& Z,
const Eigen::MatrixXd& A,
145 const Eigen::MatrixXd& upstream)
noexcept;
Per-activation hyperparameters for FlexNN::Activations.
Eigen::MatrixXd softmax_forward(const Eigen::MatrixXd &Z)
Stable column-wise softmax forward.
Definition Softmax.hpp:23
Eigen::MatrixXd forward(Activation act, const Eigen::MatrixXd &Z, const ActivationParameters ¶ms=ActivationParameters{})
Elementwise forward for a single activation.
Definition Activation.cpp:97
Eigen::MatrixXd softmax_backward_hidden(const Eigen::MatrixXd &s, const Eigen::MatrixXd &upstream) noexcept
Softmax hidden backward: dZ = J * upstream per column.
Definition Softmax.hpp:46
Eigen::MatrixXd 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).
Definition Activation.cpp:117
Definition Activation.hpp:31
const char * to_string(Activation a) noexcept
Convert Activation to canonical lower-case string.
Definition Activation.cpp:24
Activation
Activation function identifier.
Definition Activation.hpp:41
@ Sigmoid
1/(1+exp(-z)), clamped
@ Softmax
Stable col-wise softmax — only on last layer in v0.1.
@ None
Linear, no activation.
@ LeakyReLU
z>0 ? z : alpha*z (alpha from ActivationParameters)
bool try_parse(std::string_view s, Activation &out) noexcept
Parse a string into an Activation.
Definition Activation.cpp:43
Hyperparameters for activations.
Definition ActivationParameters.hpp:30