23 #ifndef MLPACK_METHODS_ANN_ACTIVATION_FUNCTIONS_MISH_FUNCTION_HPP 24 #define MLPACK_METHODS_ANN_ACTIVATION_FUNCTIONS_MISH_FUNCTION_HPP 49 static double Fn(
const double x)
51 return x * (std::exp(2 * x) + 2 * std::exp(x)) /
52 (2 + 2 * std::exp(x) + std::exp(2 * x));
61 template <
typename InputVecType,
typename OutputVecType>
62 static void Fn(
const InputVecType &x, OutputVecType &y)
64 y = x % (arma::exp(2 * x) + 2 * arma::exp(x)) /
65 (2 + 2 * arma::exp(x) + arma::exp(2 * x));
74 static double Deriv(
const double y)
76 return std::exp(y) * (4 * (y + 1) + std::exp(y) * (4 * y + 6) +
77 4 * std::exp(2 * y) + std::exp(3 * y)) /
78 std::pow(std::exp(2 * y) + 2 * std::exp(y) + 2, 2);
87 template <
typename InputVecType,
typename OutputVecType>
88 static void Deriv(
const InputVecType &y, OutputVecType &x)
90 x = arma::exp(y) % (4 * (y + 1) + arma::exp(y) % (4 * y + 6) +
91 4 * arma::exp(2 * y) + arma::exp(3 * y)) /
92 arma::pow(arma::exp(2 * y) + 2 * arma::exp(y) + 2, 2);
Linear algebra utility functions, generally performed on matrices or vectors.
static double Deriv(const double y)
Computes the first derivative of the Mish function.
The core includes that mlpack expects; standard C++ includes and Armadillo.
static double Fn(const double x)
Computes the Mish function.
The Mish function, defined by.
static void Fn(const InputVecType &x, OutputVecType &y)
Computes the Mish function.
static void Deriv(const InputVecType &y, OutputVecType &x)
Computes the first derivatives of the Mish function.