Function dfdx::tensor_ops::tanh

source ·
pub fn tanh<S: Shape, E: Dtype, D: UnaryKernel<TanhKernelOp, E>, T: Tape<E, D>>(
    t: Tensor<S, E, D, T>
) -> Tensor<S, E, D, T>
Expand description

Hyperbolic Tangent (Tanh).

The derivative is 1.0 - square(tanh(t)).

Examples:

let t = dev.tensor([-1.0, 0.0, 1.0, 2.0]);
let r = t.tanh();