Tensorflow.js tf.layers.alphaDropout() Function Last Updated : 14 Oct, 2022 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 Node.js. The tf.layers.AlphaDropout() function is used to apply Alpha Dropout to the input. Since it is a regularization layer hence, it is only active at training time. Syntax: tf.layers.AlphaDropout(arguments) Parameters inputShape : It is an optional parameter which is used to create the input layer, and it takes values like number and null.batchInputShape : It is an optional parameter which is used to create the input layer before the main layer, and it takes values like number and null.batchSize : It is an optional parameter used to make batchInputShape, and, and it accepts only numbers.dtype : It is an optional parameter, and it stands for data type. By default, it has ‘float32’ and also supports other values like ‘int32’, ‘bool’ etc.name: It is an optional parameter and is used to define the name of the layer, and it accepts strings.trainable : It is an optional parameter that determines the provided input layers are updated or not. It accepts boolean values.weights : It possesses the starting weights of the layer. It is also an optional parameter.inputDType : It is an optional parameter used for input data type. Like dtype it also supports all its values. Return Value: It returns AlphaDropout. Example 1: JavaScript // Importing the tensorflow.js library import * as tf from "@tensorflow/tfjs" // Initializing the tensor const geek= tf.tensor1d([121, 152, 2213, 7814]); // Reshaping tensor const geek1 = tf.reshape(geek,[2,2]); // Creating alphaDropout of poolSize 2*2 const alphaDropout = tf.layers.alphaDropout({poolSize:[2,2]}); // Applying alphaDropout on geek1 tensor const result = alphaDropout.apply(geek1); //Printing the result tensor result.print(); Output: Tensor [[121 , 152 ], [2213, 7814]] Example 2: JavaScript // Importing the tensorflow.js library import * as tf from "@tensorflow/tfjs" // Reshaping tensor const geek1 = tf.reshape( tf.tensor1d([25, 163, 127, 328]), [2,2]); // Applying alphaDropout on geek1 tensor tf.layers.alphaDropout( { poolSize:[2,2] } ).apply( geek1).print(); Output: Tensor [[25 , 163], [127, 328]] Reference: https://js.tensorflow.org/api/3.6.0/#layers.alphaDropout Comment More infoAdvertise with us Next Article Tensorflow.js tf.layers.alphaDropout() Function T thacker_shahid Follow Improve Article Tags : JavaScript Web Technologies Tensorflow.js Similar Reads Tensorflow.js tf.layers.dropout() 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.layers.dropout() function is an inbuilt function of Tensorflow.js library. This function is used to prevent overfitting in a mo 2 min read Tensorflow.js tf.layers.elu() 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 Node.js. The tf.lay 2 min read Tensorflow.js tf.dropout() 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.dropout() function is used to compute the dropout. You can read more about dropout from https://www.geeksforgeeks.org/dropout-i 2 min read Tensorflow.js tf.layers.flatten() 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.layers.flatten() function is used to flatten the input, without affecting the batch size. A Flatten layer flattens each batch i 2 min read Tensorflow.js tf.layers.cropping2D() Function Tensorflow.js is a Google-developed open-source toolkit for executing machine learning models and deep learning neural networks in the browser or on the node platform. It also enables developers to create machine learning models in JavaScript and utilize them directly in the browser or with Node.js. 2 min read Like