Python | Tensorflow exp() method Last Updated : 12 Dec, 2021 Summarize Comments Improve Suggest changes Share Like Article Like Report 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.exp() [alias tf.math.exp] provides support for the exponential function in Tensorflow. It expects the input in form of complex numbers as $a+bi$ or floating point numbers. The input type is tensor and if the input contains more than one element, an element-wise exponential value is computed, y=e^x$ . Syntax: tf.exp(x, name=None) or tf.math.exp(x, name=None)Parameters: x: A Tensor of type bfloat16, half, float32, float64, complex64 or complex128. name (optional): The name for the operation.Return type: A Tensor with the same size and type as that of x. Code #1: Python3 # Importing the Tensorflow library import tensorflow as tf # A constant vector of size 5 a = tf.constant([-0.5, -0.1, 0, 0.1, 0.5], dtype = tf.float32) # Applying the exp function and # storing the result in 'b' b = tf.exp(a, name ='exp') # Initiating a Tensorflow session with tf.Session() as sess: print('Input type:', a) print('Input:', sess.run(a)) print('Return type:', b) print('Output:', sess.run(b)) Output: Input type: Tensor("Const:0", shape=(5, ), dtype=float32) Input: [-0.5 -0.1 0. 0.1 0.5] Return type: Tensor("exp:0", shape=(5, ), dtype=float32) Output: [0.60653067 0.9048374 1. 1.105171 1.6487212 ] Code #2: Visualization Python3 # Importing the Tensorflow library import tensorflow as tf # Importing the NumPy library import numpy as np # Importing the matplotlib.pyplot function import matplotlib.pyplot as plt # A vector of size 21 with values from -10 to 10 a = np.linspace(-10, 10, 21) # Applying the exponential function and # storing the result in 'b' b = tf.exp(a, name ='exp') # Initiating a Tensorflow session with tf.Session() as sess: print('Input:', a) print('Output:', sess.run(b)) plt.plot(a, sess.run(b), color = 'red', marker = "o") plt.title("tensorflow.abs") plt.xlabel("X") plt.ylabel("Y") plt.show() Output: Input: [-10. -9. -8. -7. -6. -5. -4. -3. -2. -1. 0. 1. 2. 3. 4. 5. 6. 7. 8. 9. 10.] Output: [4.53999298e-05 1.23409804e-04 3.35462628e-04 9.11881966e-04 2.47875218e-03 6.73794700e-03 1.83156389e-02 4.97870684e-02 1.35335283e-01 3.67879441e-01 1.00000000e+00 2.71828183e+00 7.38905610e+00 2.00855369e+01 5.45981500e+01 1.48413159e+02 4.03428793e+02 1.09663316e+03 2.98095799e+03 8.10308393e+03 2.20264658e+04] Comment More infoAdvertise with us Next Article Python - tensorflow.math.erfc() S sanskar27jain Follow Improve Article Tags : Python AI-ML-DS With Python Practice Tags : python Similar Reads Python | Tensorflow log1p() 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.log1p() [alias tf.math.log1p] provides support for the natural logari 2 min read Python - tensorflow.math.expm1() TensorFlow is open-source Python library designed by Google to develop Machine Learning models and deep learning  neural networks. expm1() is used to compute element wise exp(x)-1. Syntax: tensorflow.math.expm1(  x, name) Parameters: x: It's the input tensor. Allowed dtypes are bfloat16, half, flo 1 min read Python - tensorflow.math.erf() TensorFlow is open-source Python library designed by Google to develop Machine Learning models and deep learning  neural networks. erf() is used to compute element wise Gauss error function. Syntax: tensorflow.math.erf(  x, name) Parameters: x: It's the input tensor. Allowed dtypes are bfloat16, h 1 min read Python - tensorflow.math.erfc() TensorFlow is open-source Python library designed by Google to develop Machine Learning models and deep learning  neural networks. erfc() is used to compute element wise complementary Gauss error function. Syntax: tensorflow.math.erfc(  x, name) Parameters: x: It's the input tensor. Allowed dtypes 1 min read Python - tensorflow.math.log1p() TensorFlow is open-source python library designed by Google to develop Machine Learning models and deep learning  neural networks. TensorFlow raw_ops provides low level access to all TensorFlow operations. Log1p() is used to find element wise logarithm of (1+x) for input x. Syntax: tf.math.log1p(x, 2 min read Python - tensorflow.eye() TensorFlow is open-source Python library designed by Google to develop Machine Learning models and deep learning  neural networks. tensorflow.eye() is used to generate identity matrix. Syntax: tensorflow.eye( num_rows, num_columns, batch_shape, dtype, name) Parameters: num_rows: It is int32 scalar 2 min read Like