chainer.functions.tanh¶
-
chainer.functions.
tanh
(x)[source]¶ Elementwise hyperbolic tangent function.
\[f(x)=\tanh(x).\]Parameters: x ( Variable
ornumpy.ndarray
orcupy.ndarray
) – 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: Variable Example
>>> x = np.arange(-1, 4, 2).astype('f') >>> x array([-1., 1., 3.], dtype=float32) >>> F.tanh(x).data array([-0.7615942, 0.7615942, 0.9950548], dtype=float32)