Deep Learning Algorithm Implementations 1.0.0
C++ implementations of fundamental deep learning algorithms
|
Hyperbolic tangent (Tanh) activation function. More...
#include <functions.hpp>
Public Member Functions | |
double | forward (double x) |
Compute tanh forward pass. | |
double | backward (double x) |
Compute tanh derivative. | |
![]() | |
virtual | ~ActivationFunction ()=default |
Virtual destructor for proper cleanup. | |
Hyperbolic tangent (Tanh) activation function.
Tanh maps input values to the range (-1, 1), making it zero-centered which can help with gradient flow during training.
Mathematical definition:
Definition at line 110 of file functions.hpp.
double dl::activation::Tanh::backward | ( | double | x | ) |
Compute tanh derivative.
x | Input value |
Definition at line 40 of file functions.cpp.
double dl::activation::Tanh::forward | ( | double | x | ) |
Compute tanh forward pass.
x | Input value |
Definition at line 34 of file functions.cpp.