fn
tanh
→Tensortanh(input: Tensor)Element-wise hyperbolic tangent.
Saturating activation mapping the real line into .
Parameters
inputTensorInput tensor.
Returns
TensorElement-wise result with the same shape as input.
Notes
Mathematical definition:
Gradient: . Common activation in RNNs.
Examples
>>> import lucid
>>> x = lucid.tensor([1.0, 2.0, 3.0])
>>> lucid.tanh(x)
Tensor([...])