Tensorflow.js tf.randomNormal() Function Last Updated : 20 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. It helps developers to develop ML models in JavaScript, and use ML directly in the browser or in Node.js. The tf.randomNormal() function is used to create a tf.Tensor with values sampled from a normal distribution. Syntax: tf.randomNormal (shape, mean, stdDev, dtype, seed) Parameters: shape: An array of integers defining the shape of the output tensor.mean: It is an optional argument. The mean of the normal distribution.stdDev: It is also an optional argument. The standard deviation of the normal distribution.dtype: The data type of the output. The values of datatype possible are 'float32' or 'int32'. It is also an optional argument.seed: It is an optional argument. The seed for the random number generator. Return Value: It returns tf.Tensor. Example 1: JavaScript // Creating the tensor with values // sampled from a normal distribution const x = tf.randomNormal([5]); // Printing the tensor x.print(); Output: Tensor [1.5322036, 2.2685387, -0.4921667, 1.1309422, 1.470457] Example 2: JavaScript // Creating the tensor with values // sampled from a normal distribution const x = tf.randomNormal([2, 2]); // Printing the tensor x.print(); Output: Tensor [[1.9162624 , -0.9760998], [-0.2262698, -2.1717837]] Example 3 JavaScript // Creating the tensor with values // sampled from a normal distribution const x=tf.randomNormal([5], 5, 1, 'int32', 2); // Printing the tensor x.print(); Output: ​Tensor [5, 7, 6, 5, 6] Reference: https://js.tensorflow.org/api/latest/#randomNormal Comment More infoAdvertise with us Next Article Tensorflow.js tf.randomNormal() Function C CoderSaty Follow Improve Article Tags : JavaScript Web Technologies Tensorflow.js Similar Reads Tensorflow.js tf.randomUniform() 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.randomUniform() function is used to create a tf.Tensor with values sampled from a uniform distribution. Syntax: tf.randomUnifor 2 min read Tensorflow.js tf.randomGamma() 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.randomGamma() function is used to create a tf.Tensor with values sampled from a gamma distribution. Syntax: tf.randomGamma(shap 2 min read Tensorflow.js tf.norm() 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.norm() function is used compute the norm of matrices, vectors, and scalar. This function can also compute several other vector 2 min read Tensorflow.js tf.initializers.randomNormal() 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.multinomial() 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 .multinomial() function is used to generate a tf.Tensor along with inputs that are dragged out of a multinomial dis 2 min read Like