Python - tensorflow.math.tanh() Last Updated : 06 Mar, 2023 Comments Improve Suggest changes Like Article Like Report TensorFlow is open-source python library designed by Google to develop Machine Learning models and deep learning neural networks. tanh() is used to find element wise hyperbolic tangent of x. Syntax: tf.math.tanh(x, name) Parameters: x: It's the input tensor. Allowed dtype for this tensor are bfloat16, half, float32, float64, complex64, complex128.name(optional): It defines the name for the operation. Returns: It returns a tensor of same dtype as x. Example 1: Python3 # Importing the library import tensorflow as tf # Initializing the input tensor a = tf.constant([1, 2, 3, 4, 5], dtype = tf.float64) # Printing the input tensor print('Input: ', a) # Calculating tangent res = tf.math.tanh(x = a) # Printing the result print('Result: ', res) Output: a: tf.Tensor([1. 2. 3. 4. 5.], shape=(5, ), dtype=float64) Result: tf.Tensor([0.76159416 0.96402758 0.99505475 0.9993293 0.9999092 ], shape=(5, ), dtype=float64) Example 2: Visualization Python3 # importing the library import tensorflow as tf import matplotlib.pyplot as plt # Initializing the input tensor a = tf.constant([1, 2, 3, 4, 5], dtype = tf.float64) # Calculating tangent res = tf.math.tanh(x = a) # Plotting the graph plt.plot(a, res, color ='green') plt.title('tensorflow.math.tanh') plt.xlabel('Input') plt.ylabel('Result') plt.show() Output: Comment More infoAdvertise with us Next Article Python - tensorflow.math.tanh() A aman neekhara Follow Improve Article Tags : Machine Learning AI-ML-DS With Python Practice Tags : Machine Learning Similar Reads Python - tensorflow.math.tan() TensorFlow is open-source python library designed by Google to develop Machine Learning models and deep learning  neural networks. tan() is used to find element wise tangent of x. Syntax: tf.math.tan(x, name) Parameters: x: It's the input tensor. Allowed dtype for this tensor are bfloat16, half, fl 1 min read Python - tensorflow.math.sinh() TensorFlow is open-source Python library designed by Google to develop Machine Learning models and deep learning  neural networks. sinh() is used to find element wise hyperbolic sine of x. Syntax: tf.math.sinh(x, name) Parameters: x: It's the input tensor. Allowed dtype for this tensor are bfloat16 1 min read Python | Tensorflow tan() method Tensorflow is an open-source machine learning library developed by Google. One of its applications is to develop deep neural networks. The module tensorflow.math provides support for many basic mathematical operations. Function tf.tan() [alias tf.math.tan] provides support for the tangent function i 2 min read Python - tensorflow.math.sin() TensorFlow is open-source python library designed by Google to develop Machine Learning models and deep learning  neural networks. sin() is used to find element wise sine of x. Syntax: tf.math.sin(x, name) Parameters: x: It's the input tensor. Allowed dtype for this tensor are bfloat16, half, float 1 min read Python - tensorflow.math.sqrt() TensorFlow is open-source Python library designed by Google to develop Machine Learning models and deep learning neural networks. sqrt() is used to compute element wise square root. Syntax: tensorflow.math.sqrt(x, name) Parameters: x: It's a tensor. Allowed dtypes are bfloat16, half, float32, float6 1 min read Like