Main Content

Compute deep learning network output for inference

Some deep learning layers behave differently during training and inference (prediction). For example, during training, dropout layers randomly set input elements to zero to help prevent overfitting, but during inference, dropout layers do not change the input.

To compute network outputs for inference, use the `predict`

function.
To compute network outputs for training, use the `forward`

function. For
prediction with `SeriesNetwork`

and `DAGNetwork`

objects, see
`predict`

.

**Tip**

For prediction with `SeriesNetwork`

and `DAGNetwork`

objects, see `predict`

.

`[dlY1,...,dlYN] = predict(___)`

returns the
`N`

outputs `dlY1`

, …, `dlYN`

during
inference for networks that have `N`

outputs using any of the previous
syntaxes.

`[dlY1,...,dlYK] = predict(___,'Outputs',`

returns the outputs `layerNames`

)`dlY1`

, …, `dlYK`

during inference for
the specified layers using any of the previous syntaxes.

`[___] = predict(___,'Acceleration',`

also specifies performance optimization to use during inference, in addition to the input
arguments in previous syntaxes. `acceleration`

)

`[___,`

also returns the updated network state.`state`

] = predict(___)

`dlarray`

| `dlgradient`

| `dlfeval`

| `forward`

| `dlnetwork`