Tensorflow.js tf.reciprocal() 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.reciprocal() function is used to return the reciprocal of the specified tensor's elements. Syntax: tf.reciprocal(x) Parameters: This function accepts a parameter which is illustrated below: x: The specified input tensor. Return Value: It returns the reciprocal 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 .reciprocal() function over // the above tensor as its parameter x.reciprocal().print(); Output: Tensor [0.5, 0.3333333, 0.25, 0.2] 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 .reciprocal() function tf.tensor1d([0, 1, -2, 1.7, -2.5]).reciprocal().print(); Output: Tensor [Infinity, 1, -0.5, 0.5882353, -0.4] Comment More infoAdvertise with us Next Article Tensorflow.js tf.reciprocal() Function K Kanchan_Ray Follow Improve Article Tags : JavaScript Web Technologies Tensorflow.js Similar Reads Tensorflow.js tf.prod() 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.prod() function is used to calculate product of the elements of a specified Tensor across its dimension. It reduces the given i 2 min read Tensorflow.js tf.prelu() 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 .prelu() function is used to find leaky rectified linear of the stated tensor input along with parametric alphas an 2 min read Tensorflow.js tf.pow() 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.pow() function is used to compute the power of one specified tensor to another. It supports broadcasting. Syntax: tf.power(base 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.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 Like