Tensorflow.js tf.square() 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.square() function is used to return the square of the specified tensor's elements. Syntax: tf.square(x) Parameters: This function accepts a parameter which is illustrated below: x: The specified input tensor. Return Value: It returns the square of the specified tensor's elements. Example 1: JavaScript // Importing the tensorflow.js library import * as tf from "@tensorflow/tfjs" // Initializing a tensor of some elements const x = tf.tensor1d([2, 3, 4, 5]); // Calling the .square() function over // the above tensor as its parameter x.square().print(); Output: Tensor [4, 9, 16, 25] Example 2: JavaScript // Importing the tensorflow.js library import * as tf from "@tensorflow/tfjs" // Using a tensor of some elements // as the parameter for the .square() function tf.tensor1d([0, 1, -2, 1.7, -2.5]).square().print(); Output: Tensor [0, 1, 4, 2.8900001, 6.25] Comment More infoAdvertise with us Next Article Tensorflow.js tf.square() Function K Kanchan_Ray Follow Improve Article Tags : JavaScript Web Technologies Tensorflow.js Similar Reads Tensorflow.js tf.sqrt() 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.sqrt() function is used to return the square root of the specified tensor's element. Syntax:Â tf.sqrt( x ) Parameters: This fun 1 min read Tensorflow.js tf.sum() 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.sum() function is used to calculate sum of the elements of a specified Tensor across its dimension. It reduces the given input 2 min read Tensorflow.js tf.squeeze() 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 .squeeze() function is used to discard the dimensions of length one out of the shape of a stated tf.Tensor. Syntax 2 min read Tensorflow.js tf.rsqrt() 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.rsqrt() function is used to return the reciprocal of square root of the specified tensor's elements. Syntax: tf.rsqrt (x) Param 1 min read Tensorflow.js tf.scalar() 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 .scalar() function is used to create a scalar type of tensor means. A scalar is a zero-dimension array and is also called a rank-0 2 min read Tensorflow.js tf.step() 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.step() function is used to return the step of the input tensor's elements i.e. it returns 1 if the element is greater than 0 el 1 min read Tensorflow.js tf.selu() 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 .selu() function is used to find the scaled exponential linear and is done element wise. Syntax: Â tf.selu(x) Where 1 min read Tensorflow.js tf.pad() 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 in Node.js. The tf. 2 min read Tensorflow.js tf.stack() 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 helps developers to develop ML models in JavaScript, and use ML directly in the browser or in Node.js. The tf.stack() function is u 2 min read Tensorflow.js tf.reshape() 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.res 2 min read Like