FlexNN 1
Fully connected neural network built from scratch with flexible n-layer design and multiple activations.
Loading...
Searching...
No Matches
Activation.cpp File Reference

Implements FlexNN::Activations helpers (to_string, try_parse, dispatch). More...

#include "activations/Activation.hpp"
#include <algorithm>
#include <cctype>
#include <string>
#include "activations/detail.hpp"
Include dependency graph for Activation.cpp:

Namespaces

namespace  FlexNN
 Namespace for the FlexNN neural network library.
 
namespace  FlexNN::Activations
 
namespace  FlexNN::Activations::detail
 

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 &params=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 &params=ActivationParameters{}) noexcept
 Elementwise backward for a single activation (hidden layers).
 

Detailed Description

Implements FlexNN::Activations helpers (to_string, try_parse, dispatch).

Why out-of-line: to_string and try_parse are non-trivial (string handling) and not hot — keeping them in a .cpp avoids inlining bloat and keeps Activation.hpp small for the many layer headers that include it. The per-activation math stays header-only inline (see include/activations) so the compiler can vectorize it at call sites.