24 #ifndef MLPACK_METHODS_ANN_ACTIVATION_FUNCTIONS_HARD_SWISH_FUNCTION_HPP 25 #define MLPACK_METHODS_ANN_ACTIVATION_FUNCTIONS_HARD_SWISH_FUNCTION_HPP 56 static double Fn(
const double x)
63 return x * (x + 3) / 6;
72 template <
typename InputVecType,
typename OutputVecType>
73 static void Fn(
const InputVecType &x, OutputVecType &y)
77 for (
size_t i = 0; i < x.n_elem; i++)
87 static double Deriv(
const double y)
94 return (2 * y + 3.0) / 6.0;
103 template <
typename InputVecType,
typename OutputVecType>
104 static void Deriv(
const InputVecType &y, OutputVecType &x)
108 for (
size_t i = 0; i < y.n_elem; i++)
The Hard Swish function, defined by.
Linear algebra utility functions, generally performed on matrices or vectors.
The core includes that mlpack expects; standard C++ includes and Armadillo.
static void Fn(const InputVecType &x, OutputVecType &y)
Computes the Hard Swish function.
static double Fn(const double x)
Computes the Hard Swish function.
static void Deriv(const InputVecType &y, OutputVecType &x)
Computes the first derivatives of the Hard Swish function.
static double Deriv(const double y)
Computes the first derivative of the Hard Swish function.