chainer.functions.tanh¶
-
chainer.functions.
tanh
(x)[source]¶ Elementwise hyperbolic tangent function.
\[f(x)=\tanh(x).\]- Parameters
x (
Variable
or N-dimensional array) – Input variable. A \((s_1, s_2, ..., s_N)\)-shaped float array.- Returns
Output variable. A \((s_1, s_2, ..., s_N)\)-shaped float array.
- Return type
Example
>>> x = np.arange(-1, 4, 2).astype(np.float32) >>> x array([-1., 1., 3.], dtype=float32) >>> F.tanh(x).array array([-0.7615942, 0.7615942, 0.9950548], dtype=float32)