Tensorflow.js tf.divNoNan() Function Last Updated : 14 May, 2021 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.divNoNan() function is used to divide two Tensors element-wise and returns 0 if the denominator is 0. It supports broadcasting. Syntax: tf.divNoNan (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 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. It returns 0 if the denominator is 0. Example 1: JavaScript // Importing the tensorflow.js library import * as tf from "@tensorflow/tfjs" // Initializing some Tensors const a = tf.tensor1d([2, 5, 7, 10]); const b = tf.tensor1d([1, 3, 2, 6]); const c = tf.tensor1d([0, 0, 0, 0]); // Calling the .divNoNan() function // over the above Tensors as its parameters a.divNoNan(b).print(); a.divNoNan(c).print(); Output: Tensor [2, 1.6666665, 3.5, 1.6666665] Tensor [0, 0, 0, 0] Example 2: JavaScript // Importing the tensorflow.js library import * as tf from "@tensorflow/tfjs" // Broadcasting div a with b and c const a = tf.tensor1d([3, 6, 11, 17]); const b = tf.scalar(2); const c = tf.scalar(0); // Calling the .divNoNan() function // over the above Tensors as its parameters a.divNoNan(b).print(); a.divNoNan(c).print(); Output: Tensor [1.5, 3, 5.5, 8.5] Tensor [0, 0, 0, 0] Comment More infoAdvertise with us Next Article Tensorflow.js tf.divNoNan() Function K Kanchan_Ray Follow Improve Article Tags : JavaScript Web Technologies Tensorflow.js Similar Reads Tensorflow.js tf.div() 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.div() function is used to divides the two specified Tensors element-wise. It supports broadcasting. Syntax: tf.div (a, b) Param 2 min read Tensorflow.js tf.any() 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. It also helps the developers to develop ML models in the JavaScript language so that ML directly can be used in the browser or in Node 1 min read 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.atan() Function Tensorflow.js is an open-source library that is being developed by Google for running machine learning models as well as deep learning neural networks in the browser or node environment. The .atan() function is used to find the atan of the stated tensor input and is done element wise. Syntax : Â tf. 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.asin() Function Tensorflow.js is an open-source library that is being developed by Google for running machine learning models as well as deep learning neural networks in the browser or node environment. The .asin() function is used to find the asin of the stated tensor elementwise. Syntax: Â tf.asin(x) Parameters: 2 min read Tensorflow.js tf.concat() 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.concat() function is used to concatenate the list of specified Tensors along the given axis. Syntax: tf.concat (tensors, axis)P 2 min read Tensorflow.js tf.dispose() Function Tensorflow.js is an open-source library developed by Google brain team for running deep learning neural networks in the browser or node environment. The .dispose() function is used to dispose a tensor to the memory. Syntax: tensor.dispose() Parameters: this method don't have any parameters Return va 2 min read Tensorflow.js tf.atan2() Function Tensorflow.js is an open-source library that is being developed by Google for running machine learning models as well as deep learning neural networks in the browser or node environment. The .atan2() function is used to find the arctangent of the stated tensor inputs and is done element wise. Moreov 2 min read Tensorflow.js tf.atanh() Function Tensorflow.js is an open-source library that is being developed by Google for running machine learning models as well as deep learning neural networks in the browser or node environment. The .atanh() function is used to find the inverse hyperbolic tan of the stated tensor input and is done elements 2 min read Like