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

Sigmoid activation — 1/(1+exp(-Z)) with clamping. More...

#include <algorithm>
#include <Eigen/Dense>
#include <cmath>
Include dependency graph for Sigmoid.hpp:
This graph shows which files directly or indirectly include this file:

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
 

Functions

Eigen::MatrixXd FlexNN::Activations::detail::sigmoid_forward (const Eigen::MatrixXd &Z)
 Sigmoid forward: A = 1/(1+exp(-clamp(Z))) elementwise.
 
Eigen::MatrixXd FlexNN::Activations::detail::sigmoid_backward (const Eigen::MatrixXd &dA, const Eigen::MatrixXd &, const Eigen::MatrixXd &A) noexcept
 Sigmoid backward: dZ = dA * A * (1 - A).
 

Detailed Description

Sigmoid activation — 1/(1+exp(-Z)) with clamping.

Clamping Z to [-15,15] avoids exp overflow and keeps host double stable while the runtime may use a LUT. Matches LLD_FLEXNN §6.5.