tanh

dragon.vm.torch.nn.functional.tanh(
  input,
  inplace=False
)[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)} \]
Parameters:
  • input (dragon.vm.torch.Tensor) The input tensor.
  • inplace (bool, optional, default=False) Whether to do the operation in-place.
Returns:

dragon.vm.torch.Tensor The output tensor.