DropoutLayer
represents a net layer that sets its input elements to zero with probability 0.5 during training.
Details and Options


- DropoutLayer is commonly used as a form of neural network regularization.
- DropoutLayer is typically used inside NetChain, NetGraph, etc.
- The following optional parameters can be included:
-
Method "Dropout" dropout method to use "OutputPorts" "Output" output ports - Possible explicit settings for the Method option include:
-
"AlphaDropout" keeps the mean and variance of the input constant; designed to be used together with the ElementwiseLayer["SELU"] activation "Dropout" sets the input elements to zero with probability p during training, multiplying the remainder by 1/(1-p) - Possible settings for the "OutputPorts" option include:
-
"BinaryMask" binary mask applied to input data "Output" output of the dropout {port1,…} a list of valid ports - DropoutLayer exposes the following ports for use in NetGraph etc.:
-
"Input" an array or sequence of arrays of arbitrary rank "Output" an array or sequence of arrays of arbitrary rank - DropoutLayer normally infers the dimensions of its input from its context in NetChain etc. To specify the dimensions explicitly as {n1,n2,…}, use DropoutLayer["Input"->{n1,n2,…}].
- DropoutLayer[…][input] explicitly computes the output from applying the layer.
- DropoutLayer[…][{input1,input2,…}] explicitly computes outputs for each of the inputi.
- When given a NumericArray as input, the output will be a NumericArray.
- DropoutLayer only randomly sets input elements to zero during training. During evaluation, DropoutLayer leaves the input unchanged, unless NetEvaluationMode->"Train" is specified when applying the layer.
- Options[DropoutLayer] gives the list of default options to construct the layer. Options[DropoutLayer[…]] gives the list of default options to evaluate the layer on some data.
- Information[DropoutLayer[…]] gives a report about the layer.
- Information[DropoutLayer[…],prop] gives the value of the property prop of DropoutLayer[…]. Possible properties are the same as for NetGraph.
Examples
open allclose allBasic Examples (1)Summary of the most common use cases
Create a DropoutLayer:

https://wolfram.com/xid/08ux6othncg1yua-qv4tqb

Apply it to an input, which remains unchanged:

https://wolfram.com/xid/08ux6othncg1yua-5ipqql

Use NetEvaluationMode to force training behavior of DropoutLayer:

https://wolfram.com/xid/08ux6othncg1yua-u01m17

Scope (2)Survey of the scope of standard use cases
Create a DropoutLayer with a specific probability:

https://wolfram.com/xid/08ux6othncg1yua-8f8zq2

Apply it to input data, which leaves the input unchanged:

https://wolfram.com/xid/08ux6othncg1yua-bso35a

Apply it to input data, specifying that training behavior be used:

https://wolfram.com/xid/08ux6othncg1yua-eji7wd

Create a DropoutLayer that takes an RGB image and returns an RGB image:

https://wolfram.com/xid/08ux6othncg1yua-b4v9zw

The DropoutLayer acts on the image represented by a rank-3 array by randomly and independently zeroing the individual color components of each pixel:

https://wolfram.com/xid/08ux6othncg1yua-s3jjxb

Options (2)Common values & functionality for each option
Method (1)
Create a DropoutLayer using "AlphaDropout" as the dropout method:

https://wolfram.com/xid/08ux6othncg1yua-e9jjao

Apply it to input data, specifying that training behavior be used:

https://wolfram.com/xid/08ux6othncg1yua-3jaubw

If the input data has a mean of 0 and a variance of 1, then the output will have the same mean and variance:

https://wolfram.com/xid/08ux6othncg1yua-qow0nu

https://wolfram.com/xid/08ux6othncg1yua-ya6a2s

https://wolfram.com/xid/08ux6othncg1yua-onilwe


https://wolfram.com/xid/08ux6othncg1yua-vqtb1o

This is not the case for the standard dropout method:

https://wolfram.com/xid/08ux6othncg1yua-sdlv51

https://wolfram.com/xid/08ux6othncg1yua-1nmoy8


https://wolfram.com/xid/08ux6othncg1yua-osaray

"OutputPorts" (1)
Create a DropoutLayer that yields the binary mask besides the output:

https://wolfram.com/xid/08ux6othncg1yua-ir4cxr


https://wolfram.com/xid/08ux6othncg1yua-vtqn2p

Apply it to input data, specifying that training behavior be used:

https://wolfram.com/xid/08ux6othncg1yua-gcqlm4

Properties & Relations (1)Properties of the function, and connections to other functions
DropoutLayer can be used between recurrent layers in a NetChain to perform regularization. A typical network used to classify sentences might incorporate a DropoutLayer as follows:

https://wolfram.com/xid/08ux6othncg1yua-m987zf

More sophisticated forms of dropout are possible by using the "Dropout" option of recurrent layers directly:

https://wolfram.com/xid/08ux6othncg1yua-l47d78


https://wolfram.com/xid/08ux6othncg1yua-2ssu6a

Possible Issues (1)Common pitfalls and unexpected behavior
By default, any randomness invoked by NetEvaluationMode->"Train" is not affected by SeedRandom and BlockRandom:

https://wolfram.com/xid/08ux6othncg1yua-c9zqq8


https://wolfram.com/xid/08ux6othncg1yua-oouzin

Use option RandomSeedingInherited to change this behavior:

https://wolfram.com/xid/08ux6othncg1yua-wa4q8n

Use option RandomSeeding to control the randomness:

https://wolfram.com/xid/08ux6othncg1yua-5xulp9

Wolfram Research (2016), DropoutLayer, Wolfram Language function, https://reference.wolfram.com/language/ref/DropoutLayer.html (updated 2020).
Text
Wolfram Research (2016), DropoutLayer, Wolfram Language function, https://reference.wolfram.com/language/ref/DropoutLayer.html (updated 2020).
Wolfram Research (2016), DropoutLayer, Wolfram Language function, https://reference.wolfram.com/language/ref/DropoutLayer.html (updated 2020).
CMS
Wolfram Language. 2016. "DropoutLayer." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2020. https://reference.wolfram.com/language/ref/DropoutLayer.html.
Wolfram Language. 2016. "DropoutLayer." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2020. https://reference.wolfram.com/language/ref/DropoutLayer.html.
APA
Wolfram Language. (2016). DropoutLayer. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/DropoutLayer.html
Wolfram Language. (2016). DropoutLayer. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/DropoutLayer.html
BibTeX
@misc{reference.wolfram_2025_dropoutlayer, author="Wolfram Research", title="{DropoutLayer}", year="2020", howpublished="\url{https://reference.wolfram.com/language/ref/DropoutLayer.html}", note=[Accessed: 26-March-2025
]}
BibLaTeX
@online{reference.wolfram_2025_dropoutlayer, organization={Wolfram Research}, title={DropoutLayer}, year={2020}, url={https://reference.wolfram.com/language/ref/DropoutLayer.html}, note=[Accessed: 26-March-2025
]}