dlfeval
Evaluate deep learning model for custom training loops
Description
Usedlfeval
to evaluate custom deep learning models for custom training loops.
Tip
For most deep learning tasks, you can use a pretrained 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, seeTrain Deep Learning Network to Classify New Images. Alternatively, you can create and train networks from scratch usinglayerGraph
objects with thetrainNetwork
andtrainingOptions
functions.
If thetrainingOptions
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, seeDefine 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使用自动分化Deep Learning Toolbox.To enable the correct evaluation of gradients, the function
fun
must use only supported functions fordlarray
. SeeList of Functions with dlarray Support.