Python - Tensorflow math.add() method Last Updated : 07 Jan, 2022 Summarize Comments Improve Suggest changes Share Like Article Like Report Tensorflow math.add() method returns the a + b of the passes inputs. The operation is done on the representation of a and b. This method belongs to math module. Syntax: tf.math.add(a, b, name=None) Arguments a: This parameter should be a Tensor and also from the one of the following types: bfloat16, half, float32, float64, uint8, int8, int16, int32, int64, complex64, complex128, string b: This should also be a Tensor and must have the same type as a. name: This is optional parameter and this is the name of the operation. Return: It returns a Tensor having the same shape as of input a. Let's see this concept with the help of few examples: Example 1: Python3 # Importing the Tensorflow library import tensorflow as tf # A constant a and b a = tf.constant(3) b = tf.constant(6) # Applying the math.add() function # storing the result in 'c' c = tf.math.add(a, b) # Initiating a Tensorflow session with tf.Session() as sess: print("Input 1", a) print(sess.run(a)) print("Input 2", b) print(sess.run(b)) print("Output: ", c) print(sess.run(c)) Output: Input 1 Tensor("Const_79:0", shape=(), dtype=int32) 3 Input 2 Tensor("Const_80:0", shape=(), dtype=int32) 6 Output: Tensor("Add_1:0", shape=(), dtype=int32) 9 Example 2: Python3 # Importing the Tensorflow library import tensorflow as tf # A constant a and b a = tf.constant(u"This is ") b = tf.constant(u"GeeksForGeeks") # Applying the math.add() function # storing the result in 'c' c = tf.math.add(a, b) # Initiating a Tensorflow session with tf.Session() as sess: print("Input 1", a) print(sess.run(a)) print("Input 2", b) print(sess.run(b)) print("Output: ", c) print(sess.run(c)) Output: Input 1 Tensor("Const_87:0", shape=(), dtype=string) b'This is ' Input 2 Tensor("Const_88:0", shape=(), dtype=string) b'GeeksForGeeks' Output: Tensor("Add_5:0", shape=(), dtype=string) b'This is GeeksForGeeks' Comment More infoAdvertise with us Next Article Python - Tensorflow math.accumulate_n() method P PranchalKatiyar Follow Improve Article Tags : Python AI-ML-DS With Python Practice Tags : python Similar Reads Python - Tensorflow math.add_n() method Tensorflow math.add_n() method adds the all passed tensors element-wise. The operation is done on the representation of a and b. This method belongs to math module. Syntax: tf.math.add_n(inputs, name=None) Arguments inputs: It specifies a list of tf.Tensor or tf.IndexedSlices objects, and the shape 2 min read Python - Tensorflow math.accumulate_n() method Tensorflow math.accumulate_n() method performs the element-wise sum of a list of passed tensors. The result is a tensor after performing the operation. The operation is done on the representation of a and b. This method belongs to math module. Syntax: tf.math.accumulate_n( inputs, shape=None, tensor 2 min read Python - tensorflow.math.divide() TensorFlow is open-source Python library designed by Google to develop Machine Learning models and deep learning  neural networks. divide() is used to compute element wise style division of x by y. Syntax: tensorflow.math.divide( x, y, name) Parameters: x: It is a tensor.y: It is a tensor.name(opti 2 min read Python - tensorflow.math.pow() TensorFlow is open-source python library designed by Google to develop Machine Learning models and deep learning  neural networks. pow() is used to find element wise x^y. Syntax: tf.math.pow(x, y, name) Parameter: x: It's the input tensor. Allowed dtype for this tensor are float16, float32, float64, 2 min read Python - tensorflow.math.asin() TensorFlow is open-source python library designed by Google to develop Machine Learning models and deep learning  neural networks. asin() is used to find element wise asin of x. Syntax: tf.math.asin(x, name) Parameters: x: It's the input tensor. Allowed dtype for this tensor are bfloat16, half, flo 1 min read Python - tensorflow.math.multiply() TensorFlow is open-source python library designed by Google to develop Machine Learning models and deep learning  neural networks. multiply() is used to find element wise x*y. It supports broadcasting. Syntax: tf.math.multiply(x, y, name) Parameter: x: It's the input tensor. Allowed dtype for this t 2 min read Like