tanh

dragon.vm.tensorflow.math.tanh(
  x,
  name=None,
  **kwargs
)[source]

Apply the tanh function.

The Tanh function is defined as:

\[\text{Tanh}(x) = \frac{e^{x} - e^{-x}}{e^{x} + e^{-x}} \]

Examples:

x = tf.constant([0.2, 0.4, 0.6, 0.8, 1.0])
print(tf.math.tanh(x))
Parameters:
  • x (dragon.Tensor) – The input tensor.
  • name (str, optional) – A optional name for the operation.
Returns:

dragon.Tensor – The output tensor.