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 (s1,s2,...,sN)-shaped float array.

Returns

Output variable. A (s1,s2,...,sN)-shaped float array.

Return type

Variable

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)