Tensorflow.js tf.div() Function Last Updated : 20 Jan, 2023 Comments Improve Suggest changes Like Article Like Report Tensorflow.js is an open-source library developed by Google for running machine learning models and deep learning neural networks in the browser or node environment. The tf.div() function is used to divides the two specified Tensors element-wise. It supports broadcasting. Syntax: tf.div (a, b) Parameters: This function accepts two parameters which are illustrated below: a: The first input tensor as the numerator.b: The second input tensor as the denominator. It should must have the same data type as "a". Return Value: It returns a Tensor for the result of a/b, where a is the first Tensor and b is the second Tensor. Example 1: JavaScript // Importing the tensorflow.js library import * as tf from "@tensorflow/tfjs" // Initializing two Tensors const a = tf.tensor1d([3, 5, 10, 15]); const b = tf.tensor1d([2, 5, 2, 7]); // Calling the .div() function over the // above Tensors as its parameters a.div(b).print(); Output: Tensor [1.5, 1, 5, 2.1428571] Example 2: JavaScript // Importing the tensorflow.js library import * as tf from "@tensorflow/tfjs" // Broadcasting the div a with b const a = tf.tensor1d([1, 12, 17, 20]); const b = tf.scalar(3); // Calling the .div() function over the // above Tensors as its parameters a.div(b).print(); Output: Tensor [0.3333333, 3.9999998, 5.6666665, 6.666666] Comment More infoAdvertise with us Next Article Tensorflow.js tf.div() Function K Kanchan_Ray Follow Improve Article Tags : JavaScript Web Technologies Tensorflow.js Similar Reads Tensorflow.js tf.dot() Function Tensorflow.js is an open-source library developed by Google for running machine learning models and deep learning neural networks in the browser or node environment. The tf.dot() function is used to compute the dot product of two given matrices or vectors, t1 and t2. Syntax:Â tf.dot(t1, t2); Paramet 1 min read Tensorflow.js tf.env() Function Tensorflow.js is an open-source library that is developed by Google for running machine learning models as well as deep learning neural networks in the browser or node environment. The .env() function is used to return the present environment i.e. a global entity. Moreover, the environment object in 1 min read Tensorflow.js tf.fill() Function Tensorflow.js is an open-source library for creating machine learning models in Javascript that allows users to run the models directly in the browser. The tf.fill() is a function defined in the class tf.Tensor. It is used to create a tensor that is filled with a scalar value. Syntax: tf.fill( shape 2 min read Tensorflow.js tf.addN() Function Tensorflow.js is an open-source library developed by Google for running machine learning models and deep learning neural networks in the browser or node environment. The tf.addN() function is used to add a specified list of Tensors element-wise. Each Tensor should be of the same shape and data type. 1 min read Tensorflow.js tf.floorDiv() Function Tensorflow.js is an open-source library developed by Google for running machine learning models and deep learning neural networks in the browser or node environment. The tf.floorDiv() function is used to divide two Tensors element-wise and the returned result is rounded with floor function. It suppo 2 min read Like