dlaccelerate
Description
Use dlaccelerate
to speed up deep learning function
evaluation for custom training loops.
The returned AcceleratedFunction
object caches the
traces of calls to the underlying function and reuses the cached
result when the same input pattern reoccurs.
Try using dlaccelerate
for function calls that:
are long-running
have
dlarray
objects, structures ofdlarray
objects, ordlnetwork
objects as inputsdo not have side effects like writing to files or displaying output
Invoke the accelerated function as you would invoke the underlying function. Note that the accelerated function is not a function handle.
Note
When using the dlfeval
function, the software automatically
accelerates the forward
and predict
functions for
dlnetwork
input. If you accelerate a deep learning function where the
majority of the computation takes place in calls to the forward
or
predict
functions for dlnetwork
input, then you might
not see an improvement in training time.
For more information, see Deep Learning Function Acceleration for Custom Training Loops.
creates an accfun
= dlaccelerate(fun
)AcceleratedFunction
object that retains the underlying traces of
the specified function handle fun
.
Caution
An AcceleratedFunction
object is not aware of updates to the underlying
function. If you modify the function associated with the accelerated function, then
clear the cache using the clearCache
object function or alternatively use the command
clear functions
.
Examples
Input Arguments
Output Arguments
More About
Version History
Introduced in R2021a
See Also
AcceleratedFunction
| clearCache
| dlarray
| dlgradient
| dlfeval
Topics
- Deep Learning Function Acceleration for Custom Training Loops
- Accelerate Custom Training Loop Functions
- Check Accelerated Deep Learning Function Outputs
- Evaluate Performance of Accelerated Deep Learning Function
- Use Automatic Differentiation In Deep Learning Toolbox
- List of Functions with dlarray Support