Dragon API Dragon v0.3.0 Python Tanh¶ class dragon.vm.torch.nn.Tanh(inplace=False)[source]¶ Apply the tanh function. The Tanh function is defined as: \[\text{Tanh}(x) = \frac{\exp(x) - \exp(-x)}{\exp(x) + \exp(-x)} \] Examples: m = torch.nn.Tanh() x = torch.randn(2, 3) y = m(x) See also torch.nn.functional.tanh(…) __init__¶ Tanh.__init__(inplace=False)[source]¶ Create a Tanh module. Parameters: inplace (bool, optional, default=False) – Whether to do the operation in-place.