Tensorflow.js tf.initializers.leCunUniform() Function Last Updated : 21 Jul, 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.leCunUniform() function takes samples from a uniform distribution in the interval [-cap, cap] with cap = sqrt(3 / fanIn). Note that the fanIn is the number of inputs in the tensor weight. Syntax: tf.initializers.leCunUniform(arguments). Parameters: arguments: It is an object that contains seed (a number) which is the random number generator seed/number. Returns value: It returns tf.initializers.Initializer. Example 1: JavaScript // Importing the tensorflow.Js library import * as tf from "@tensorflow/tfjs" // Initialising the .initializers.leCunUniform() function console.log(tf.initializers.leCunUniform(4)); // Printing individual values from the gain console.log("\nIndividual Values\n"); console.log(tf.initializers.leCunUniform(4).scale); console.log(tf.initializers.leCunUniform(4).mode); console.log(tf.initializers.leCunUniform(4).distribution); Output: { "scale": 1, "mode": "fanIn", "distribution": "uniform" } Individual Values 1 fanIn uniform Example 2: JavaScript // Importing the tensorflow.Js library import * as tf from "@tensorflow/tfjs" // Defining the input value let inputValue = tf.input({ shape: [4] }); // Initializing tf.initializers.leCunUniform() // function let funcValue = tf.initializers.leCunUniform(6) // Creating dense layer 1 let dense_layer_1 = tf.layers.dense({ units: 3, activation: 'relu', kernelInitialize: funcValue }); // Creating dense layer 2 let dense_layer_2 = tf.layers.dense({ units: 6, activation: 'softmax' }); // Output Value let outputValue = dense_layer_2.apply( dense_layer_1.apply(inputValue) ); // Creation the model let model = tf.model({ inputs: inputValue, outputs: outputValue }); // Predicting the output let finalOutput = model.predict(tf.ones([2, 4])); finalOutput.print(); Output: Tensor [[0.1853671, 0.1406064, 0.1505066, 0.1183221, 0.2430924, 0.1621054], [0.1853671, 0.1406064, 0.1505066, 0.1183221, 0.2430924, 0.1621054]] Reference: https://js.tensorflow.org/api/latest/#initializers.leCunUniform Comment More infoAdvertise with us Next Article Tensorflow.js tf.initializers.leCunNormal() Function C cyber_psych0 Follow Improve Article Tags : JavaScript Web Technologies Tensorflow.js TensorFlow.js-Initializers Similar Reads 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.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. 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.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.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.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 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 Like