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-in-neural-networks/.
tf.dropout (x, rate, noiseShape?, seed?)
- x: a tensor with floating input values.
- rate (number): the probability that each element of x is discarded. Takes in values in the range 0 to 1.
- noiseShape (number): array representing the shape for randomly generated keep/drop flags. It is optional to prove this parameter. Type: int32.
- seed (number or string): it is used to create random seeds. It is optional to provide this parameter.
Return Value: It returns tf.Tensor.
Tensor [0, 5, 5, 0]
In this example we’ll pass the noiseShape as [4, 1] to create a new dimension size.
Tensor [[0 , 0, 0 , 0 ], [0 , 0, 0 , 0 ], [2.5, 5, 7.5, 2.5], [2.5, 5, 7.5, 2.5]]