The math.tanh()  Function returns the hyperbolic tangent of x, where x is the input parameter. 

math.tanh(x)

Where  x is the numeric value whose hyperbolic tangent we want .

import math

print(math.tanh(0))
print(math.tanh(math.pi / 2)) 
print(math.tanh(-math.pi))

The math.tanh() function  is commonly used in machine learning and neural networks. It is used to calculate the activation function for neurons, as well as to calculate the gradient of the neural network.