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


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

import math

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

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.