pub fn tanh<T: Tensor<Dtype = f32>>(t: T) -> T
Expand description

Hyperbolic Tangent (Tanh) computes tanh(x).

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

Examples:

let t = Tensor1D::new([-1.0, 0.0, 1.0, 2.0]);

// use function version
let r = tanh(t.clone());

// or the tensor method!
let r2 = t.tanh();