tanh

dragon.vm.tensorflow.keras.activations.tanh(
  x,
  **kwargs
)[source]

Apply the tanh function to input.

The Tanh function is defined as:

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

Examples:

x = tf.constant([0.2, 0.4, 0.6, 0.8, 1.0], 'float32')
print(tf.keras.activations.tanh(x, inplace=False))
Parameters:
Returns:

dragon.Tensor – The output tensor.