NetEvaluationMode

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 all

Basic 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:

Wolfram Research (2017), NetEvaluationMode, Wolfram Language function, https://reference.wolfram.com/language/ref/NetEvaluationMode.html.

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

BibTeX

@misc{reference.wolfram_2024_netevaluationmode, author="Wolfram Research", title="{NetEvaluationMode}", year="2017", howpublished="\url{https://reference.wolfram.com/language/ref/NetEvaluationMode.html}", note=[Accessed: 22-December-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_netevaluationmode, organization={Wolfram Research}, title={NetEvaluationMode}, year={2017}, url={https://reference.wolfram.com/language/ref/NetEvaluationMode.html}, note=[Accessed: 22-December-2024 ]}