TF 2.0 is out! Get hands-on practice at TF World, Oct 28-31. Use code TF20 for 20% off select passes. Register now


TensorFlow 1 version View source on GitHub

Class Dropout

Applies Dropout to the input.

Inherits From: Layer


  • Class tf.compat.v1.keras.layers.Dropout
  • Class tf.compat.v2.keras.layers.Dropout

Used in the guide:

Used in the tutorials:

Dropout consists in randomly setting a fraction rate of input units to 0 at each update during training time, which helps prevent overfitting.


  • rate: Float between 0 and 1. Fraction of the input units to drop.
  • noise_shape: 1D integer tensor representing the shape of the binary dropout mask that will be multiplied with the input. For instance, if your inputs have shape (batch_size, timesteps, features) and you want the dropout mask to be the same for all timesteps, you can use noise_shape=(batch_size, 1, features).
  • seed: A Python integer to use as random seed.

Call arguments:

  • inputs: Input tensor (of any rank).
  • training: Python boolean indicating whether the layer should behave in training mode (adding dropout) or in inference mode (doing nothing).


View source