dlfeval
Description
Use dlfeval
to evaluate custom deep learning models for
custom training loops.
Tip
For most deep learning tasks, you can use a pretrained neural network and adapt it to your own
data. For an example showing how to use transfer learning to retrain a convolutional neural
network to classify a new set of images, see Train Deep Learning Network to Classify New Images. Alternatively, you can create and train
neural networks from scratch using layerGraph
objects with the trainNetwork
and trainingOptions
functions.
If the trainingOptions
function does not provide the training options that you need for your task, then you can create a custom training loop using automatic differentiation. To learn more, see Define Deep Learning Network for Custom Training Loops.
Examples
Input Arguments
Output Arguments
Tips
A
dlgradient
call must be inside a function. To obtain a numeric value of a gradient, you must evaluate the function usingdlfeval
, and the argument to the function must be adlarray
. See Use Automatic Differentiation In Deep Learning Toolbox.To enable the correct evaluation of gradients, the function
fun
must use only supported functions fordlarray
. See List of Functions with dlarray Support.
Algorithms
Extended Capabilities
Version History
Introduced in R2019b