NetEvaluationMode
is an option that can be given when applying neural net functions to input data, specifying whether the net should use training-specific behavior.
Details
- When a net is applied to an input, net[input,NetEvaluationMode->spec] specifies how layers such as DropoutLayer within the net should behave.
- With the setting NetEvaluationMode->"Test", the normal behavior of layers like DropoutLayer will be used.
- With the setting NetEvaluationMode->"Train", the training-specific behavior of layers like DropoutLayer will be used.
- Recurrent layers such as LongShortTermMemoryLayer also have training-specific behavior via the "Dropout" option.
- Training a net with NetTrain[net,…] will automatically use training-specific behavior.
Examples
open allclose allBasic Examples (2)
Normally, training layers like DropoutLayer act like the identity. Create a dropout layer and apply it to an input:
Apply the dropout layer with its training behavior, in which roughly half of the vector components are set to zero and the other half are doubled:
Create an ImageAugmentationLayer that takes an image of size 128×128 and returns an image crop of size 64×64:
Apply the layer to an image, obtaining the center crop:
Apply the layer to an image, specifying that training behavior be used. A random crop will be made and the image will be reflected with the given probabilities:
Possible Issues (1)
Currently, any randomness invoked by NetEvaluationMode->"Train" is not affected by SeedRandom and BlockRandom:
Text
Wolfram Research (2017), NetEvaluationMode, Wolfram Language function, https://reference.wolfram.com/language/ref/NetEvaluationMode.html.
CMS
Wolfram Language. 2017. "NetEvaluationMode." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/NetEvaluationMode.html.
APA
Wolfram Language. (2017). NetEvaluationMode. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/NetEvaluationMode.html