Hyperbolic Tangent (Tanh)#

API#

class warp_nn.modules.activations.Tanh[source]#

Bases: Module

Hyperbolic Tangent (Tanh) activation function.

This class computes the element-wise hyperbolic tangent activation function:

\[\text{Tanh}(x) = \frac{\sinh(x)}{\cosh(x)} = \frac{e^x - e^{-x}}{e^x + e^{-x}}\]
__call__(input: array) array[source]#

Forward pass of the activation function.

Parameters:

input – The input array, with up to 3 dimensions.

Returns:

The output array, with same shape as the input array.