tanh¶
dragon.math.
tanh
(
inputs,
inplace=False,
**kwargs
)[source]¶Compute the tanh of input.
The Tanh function is defined as:
\[\text{Tanh}(x) = \frac{\exp(x) - \exp(-x)}{\exp(x) + \exp(-x)} \]Examples:
x = dragon.constant([0.2, 0.4, 0.6, 0.8, 1.0]) print(dragon.math.tanh(x))
- Parameters:
- inputs (dragon.Tensor) – The input tensor.
- inplace (bool, optional, default=False) – Call in-place or return a new tensor.
- Returns:
dragon.Tensor – The output tensor.