Tensorflow.js tf.batchNorm() Function Last Updated : 30 Aug, 2021 Comments Improve Suggest changes Like Article Like Report 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 .batchNorm() function is useful in batch normalization. Moreover, the mean, variance, scale, including offset can be of two shapes: It can be of shape same as the stated input.In general case, the depth size is the last size of the stated input tensor, so the values can be an tf.Tensor1D of shape [depth]. Syntax: tf.batchNorm(x, mean, variance, offset?, scale?, varianceEpsilon?) Parameters: x: The stated input Tensor. It can be of type tf.Tensor, TypedArray, or Array.mean: The stated mean tensor. It can be of type tf.Tensor, tf.Tensor1D, TypedArray, or Array.variance: The stated variance tensor. It can be of type tf.Tensor, tf.Tensor1D, TypedArray, or Array.offset: The stated offset tensor. It is optional and can be of type tf.Tensor, tf.Tensor1D, TypedArray, or Array.scale: The stated scale tensor. It is optional and can be of type tf.Tensor, tf.Tensor1D, TypedArray, or Array.varianceEpsilon: The stated minor float number in order to escape division by 0. It is optional and is of type number. Return Value: It returns tf.Tensor. Example 1: JavaScript // Importing the tensorflow.js library import * as tf from "@tensorflow/tfjs" // Defining input tensor const a = tf.tensor1d([1, 5, 3]); // Defining mean const b = tf.tensor1d([1, 1, 2]); // Defining variance const c = tf.tensor1d([1, 0, 1]); // Calling batchNorm() function tf.batchNorm(a, b, c).print(); Output: Tensor [0, 126.4911041, 0.9995003] Example 2: JavaScript // Importing the tensorflow.js library import * as tf from "@tensorflow/tfjs" // Defining input tensor const a = tf.tensor1d([1, 5, 3]); // Defining mean const b = tf.tensor1d([1, 1, 2]); // Defining variance const c = tf.tensor1d([1, 0, 1]); // Defining offset const d = tf.tensor1d([1, 6, 2]); // Defining scale const e = tf.tensor1d([1, 0, 1]); // Calling batchNorm() function a.batchNorm(b, c, d, e, 9).print(); Output: Tensor [1, 6, 2.3162277] Reference: https://js.tensorflow.org/api/latest/#batchNorm Comment More infoAdvertise with us Next Article Tensorflow.js tf.batchNorm() Function nidhi1352singh Follow Improve Article Tags : JavaScript Web Technologies Tensorflow.js Similar Reads 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.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 Tensorflow.js tf.acosh() 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 .acosh() function is used to find the inverse hyperbolic cos of the stated tensor element input. Syntax:  tf 2 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.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.asinh() 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 .asinh() function is used to find the inverse hyperbolic sin of the stated tensor input and is done elements 2 min read Tensorflow.js tf.floor() 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 .floor() function is used to find the floor of the stated tensor input and is done elements wise. Syntax : 2 min read Tensorflow.js tf.batchToSpaceND() 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.batchToSpaceND() function is used to restructure the given "batch" from their zero dimension to "M+1" dimensions having shape o 2 min read Tensorflow.js tf.conv2d() Function Tensorflow.js is a javascript library developed by Google to run and train machine learning models in the browser or in Node.js. The tf.conv2d() function is used to compute 2d convolutions over the given input. In a deep neural network, we use this convolution layer which creates a convolution kern 4 min read Like