Tensorflow.js tf.batchNorm() 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 .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].
tf.batchNorm(x, mean, variance, offset?, scale?, varianceEpsilon?)
- 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.
Tensor [0, 126.4911041, 0.9995003]
Tensor [1, 6, 2.3162277]