Tensorflow.js tf.equal() Function Last Updated : 10 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.equal() function is used to return the tensor of Boolean values for the two specified tensor values i.e. it returns true if the value of the first tensor is equal to the second tensor value else returns false. It supports broadcasting. Syntax: tf.equal(a, b) Parameters: This function accepts two parameters which are illustrated below: a: The first input tensor.b: The second input tensor. It should have values of the same data type as of tensor "a". Return Value: It returns the tensor of Boolean values i.e. true if the value of the first tensor is equal to the second tensor value else returns false. Example 1: JavaScript // Importing the tensorflow.js library import * as tf from "@tensorflow/tfjs" // Initializing two different tensors const a = tf.tensor1d([2, 4, 6, 8]); const b = tf.tensor1d([1, 4, 7, 8]); // Calling the .equal() function a.equal(b).print(); Output: Tensor [false, true, false, true] Example 2: JavaScript // Importing the tensorflow library import * as tf from "@tensorflow/tfjs" // Calling the .equal() function with two // Different tensors as its parameters tf.tensor1d([1.5, 2.6, 2, 0.5, 4.5]). equal(tf.tensor1d([1.5, 2.60, 2.0, .5, 4.05])).print(); Output: Tensor [true, true, true, true, false] Reference: https://js.tensorflow.org/api/latest/#equal Comment More infoAdvertise with us Next Article Tensorflow.js tf.equal() Function K Kanchan_Ray Follow Improve Article Tags : JavaScript Web Technologies Tensorflow.js Similar Reads Tensorflow.js tf.all() 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 JavaScript language and can use ML directly in the browser or Node.js. The tf. al 1 min read Tensorflow.js tf.elu() 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 .elu() function is used to find the exponential linear of the stated tensor input and is done elements wise. 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.eye() 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.eye() is a function defined in the class tf.Tensor. Itâs used to create an identity matrix of specified rows and columns. An identity matrix 3 min read Tensorflow.js tf.exp() 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 .exp() function is used to find the exponential value i.e, (e^x) of the stated tensor input, and it is done e 2 min read Like