27 #ifndef MLPACK_METHODS_ANN_ACTIVATION_FUNCTIONS_SILU_FUNCTION_HPP 28 #define MLPACK_METHODS_ANN_ACTIVATION_FUNCTIONS_SILU_FUNCTION_HPP 52 static double Fn(
const double x)
54 return x / (1.0 + std::exp(-x));
63 template<
typename InputVecType,
typename OutputVecType>
64 static void Fn(
const InputVecType &x, OutputVecType &y)
66 y = x / (1.0 + arma::exp(-x));
75 static double Deriv(
const double x)
77 double sigmoid = 1.0 / (1.0 + std::exp(-x));
78 return sigmoid * (1.0 + x * (1.0 - sigmoid));
87 template<
typename InputVecType,
typename OutputVecType>
88 static void Deriv(
const InputVecType &x, OutputVecType &y)
90 OutputVecType sigmoid = 1.0 / (1.0 + arma::exp(-x));
91 y = sigmoid % (1.0 + x % (1.0 - sigmoid));
static double Fn(const double x)
Computes the SILU function.
Linear algebra utility functions, generally performed on matrices or vectors.
The core includes that mlpack expects; standard C++ includes and Armadillo.
static double Deriv(const double x)
Computes the first derivative of the SILU function.
The SILU function, defined by.
static void Fn(const InputVecType &x, OutputVecType &y)
Computes the SILU function.
static void Deriv(const InputVecType &x, OutputVecType &y)
Computes the first derivatives of the SILU function.