chainer.functions.tanh(x)[source]

要素ごとのハイパボリックタンジェント関数。

\[f(x)=\tanh(x).\]
Parameters: x (Variable or numpy.ndarray or cupy.ndarray) – 入力値。A \((s_1, s_2, ..., s_N)\)-型の float 配列。
Returns: 出力値。A \((s_1, s_2, ..., s_N)\)-型の float 配列。
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.76159418, 0.76159418, 0.99505478], dtype=float32)