TanhFunction Class Reference

The tanh function, defined by. More...

Static Public Member Functions

static double Deriv (const double y)
 Computes the first derivative of the tanh function. More...

 
template
static void Deriv (const InputVecType &y, OutputVecType &x)
 Computes the first derivatives of the tanh function. More...

 
static double Fn (const double x)
 Computes the tanh function. More...

 
template
static void Fn (const InputVecType &x, OutputVecType &y)
 Computes the tanh function. More...

 
static double Inv (const double y)
 Computes the inverse of the tanh function. More...

 
template
static void Inv (const InputVecType &y, OutputVecType &x)
 Computes the inverse of the tanh function. More...

 

Detailed Description

The tanh function, defined by.

\begin{eqnarray*} f(x) &=& \frac{e^x - e^{-x}}{e^x + e^{-x}} \\ f'(x) &=& 1 - \tanh^2(x) \\ f^{-1}(x) &=& \arctan(x) \end{eqnarray*}

Definition at line 29 of file tanh_function.hpp.

Member Function Documentation

◆ Deriv() [1/2]

static double Deriv ( const double  y)
inlinestatic

Computes the first derivative of the tanh function.

Parameters
yInput activation.
Returns
f'(x)

Definition at line 61 of file tanh_function.hpp.

◆ Deriv() [2/2]

static void Deriv ( const InputVecType &  y,
OutputVecType &  x 
)
inlinestatic

Computes the first derivatives of the tanh function.

Parameters
yInput activations.
xThe resulting derivatives.

Definition at line 73 of file tanh_function.hpp.

◆ Fn() [1/2]

static double Fn ( const double  x)
inlinestatic

Computes the tanh function.

Parameters
xInput data.
Returns
f(x).

Definition at line 38 of file tanh_function.hpp.

◆ Fn() [2/2]

static void Fn ( const InputVecType &  x,
OutputVecType &  y 
)
inlinestatic

Computes the tanh function.

Parameters
xInput data.
yThe resulting output activation.

Definition at line 50 of file tanh_function.hpp.

◆ Inv() [1/2]

static double Inv ( const double  y)
inlinestatic

Computes the inverse of the tanh function.

Parameters
yInput data.
Returns
f^{-1}(x)

Definition at line 84 of file tanh_function.hpp.

◆ Inv() [2/2]

static void Inv ( const InputVecType &  y,
OutputVecType &  x 
)
inlinestatic

Computes the inverse of the tanh function.

Parameters
yInput data.
xThe resulting inverse of the input data.

Definition at line 96 of file tanh_function.hpp.


The documentation for this class was generated from the following file:
  • /home/jenkins-mlpack/mlpack.org/_src/mlpack-3.4.2/src/mlpack/methods/ann/activation_functions/tanh_function.hpp