Tensorflow.js tf.initializers.randomUniform() Function Last Updated : 31 Aug, 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 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.initializers.randomUniform() function generates random values that is initialized to a uniform distribution. The values are distributed uniformly between the configured min-value and max-value. Syntax: tf.initializers.randomUniform(arguments) Parameters: arguments: It is an object that contains 3 key-values listed below:mean: It is the mean of the random values to be generated.stddev: It is the standard deviation of the random values to be generated.seed: It is the random number generator seed. Returns value: It returns tf.initializers.Initializer Example 1: JavaScript // Importing the tensorflow.js library import * as tf from "@tensorflow/tfjs" // Initializing the .initializers.randomUniform() function let geek = tf.initializers.randomUniform(5) // Printing gain value console.log(geek); // Printing individual gain value. console.log('\nIndividual values:\n'); console.log(geek.DEFAULT_MINVAL); console.log(geek.DEFAULT_MAXVAL); console.log(geek.minval); console.log(geek.maxval); Output: { "DEFAULT_MINVAL": -0.05, "DEFAULT_MAXVAL": 0.05, "minval": -0.05, "maxval": 0.05 } Individual values: -0.05 0.05 -0.05 0.05 Example 2: JavaScript // Importing the tensorflow.Js library import * as tf from "@tensorflow/tfjs // Defining the input value const inputValue = tf.input({shape:[4]}); // Initializing tf.initializers.randomUniform() function. const funcValue = tf.initializers.randomUniform(8) // Creating dense layer 1 const dense_layer_1 = tf.layers.dense({ units: 5, activation: 'relu', kernelInitialize: funcValue }); // Creating dense layer 2 const dense_layer_2 = tf.layers.dense({ units: 7, activation: 'softmax' }); // Output const outputValue = dense_layer_2.apply( dense_layer_1.apply(inputValue) ); // Creation the model. const model = tf.model({ inputs: inputValue, outputs: outputValue }); // Predicting the output. model.predict(tf.ones([2, 4])).print(); Output: Tensor [[0.1145501, 0.133405, 0.0640167, 0.2349582, 0.1064994, 0.0799759, 0.2665946], [0.1145501, 0.133405, 0.0640167, 0.2349582, 0.1064994, 0.0799759, 0.2665946]] Reference: https://js.tensorflow.org/api/3.6.0/#initializers.randomUniform Comment More infoAdvertise with us Next Article Tensorflow.js tf.initializers.randomUniform() Function T thacker_shahid Follow Improve Article Tags : JavaScript Web Technologies Tensorflow.js TensorFlow.js-Initializers Similar Reads 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.initializers.leCunUniform() 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.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.initializers.ones() Function Tensorflow.js is a very well-known machine learning library that used to develop a machine learning model using JavaScript. The main purpose to use this library is to run and deploy a machine learning model directly from the browser or in Node.js. Tensorflow.js is an open-source hardware-accelerated 2 min read Tensorflow.js tf.initializers.leCunNormal() 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.initializers.orthogonal() 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.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 helps developers to develop ML models in JavaScript, and use ML directly in the browser or in Node.js. The tf.randomNormal() functi 2 min read Tensorflow.js tf.initializers.zeros() 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 tf.initializers.zeros() function is an initializer that is used to produce tensors that are initialized to zero. Sy 1 min read Tensorflow.js tf.initializers.heNormal() 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.initializers.identity() 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 Initializer class is the base class of all initializers in Tensorflow.js. The initializers are used to initialize the Tensors with 2 min read Like