tanh

tripy.tanh(input: Tensor) Tensor[source]

Computes the elementwise hyperbolic tangent of the elements of the input tensor.

Parameters:

input (Tensor) – The input tensor.

Returns:

A new tensor.

Return type:

Tensor

Example
Example
1input = tp.arange(3, dtype=tp.float32)
2output = tp.tanh(input)
>>> input
tensor([0.0000, 1.0000, 2.0000], dtype=float32, loc=gpu:0, shape=(3,))
>>> output
tensor([0.0000, 0.7616, 0.9640], dtype=float32, loc=gpu:0, shape=(3,))