dlfeval — Evaluate a function handle in Deep Learning compatibility context.
dlfeval(fun,args...) invokes a function handle through RunMat's function-handle dispatch and forwards requested outputs.
Syntax
varargout = dlfeval(fun, args...)How dlfeval works
funmust be a function handle value, including named handles, method handles, bound handles, and closures.- Requested output count is preserved, so bracketed multi-output calls forward to the invoked function.
- A bounded automatic-differentiation tape is installed for the call. Host
dlarrayinputs, supporteddlnetworklearnables, dlarray arithmetic, scalar sums, and supportedforwardlayer chains can be differentiated withdlgradientinsidefun. - Text function names and callable objects are rejected by
dlfeval; usefevalfor those RunMat extension forms.
GPU memory and residency
dlfeval preserves callable dispatch behavior. GPU-backed dlarray values are rejected for automatic differentiation with an explicit provider-gap error because provider-resident tape kernels are not implemented yet.
Example
Evaluate Function
[loss,gradients] = dlfeval(@modelLoss, net, X, T)Expected output:
Outputs returned by `modelLoss`, including traced losses and gradients from `dlgradient`.Using dlfeval with coding agents
Open a RunMat example with live inputs, then ask the agent to explain how dlfeval changes the result.
Run a small dlfeval example, explain the result, then change one input and compare the output.
Related Deep Learning functions
adamupdate · analyzeNetwork · bilstmLayer · classificationLayer · combvec · convolution1dLayer · crossentropy · dlarray · dlgradient · dlnetwork · dlupdate · eluLayer · exportONNXNetwork · featureInputLayer · forward · fullyConnectedLayer · globalAveragePooling1dLayer · layerGraph · layerNormalizationLayer · lstmLayer · padsequences · regressionLayer · reluLayer · sequenceInputLayer · softmaxLayer · trainingOptions · trainnet · trainNetwork
About RunMat
RunMat is an open-source runtime that executes MATLAB-syntax code blazing on any GPU. It is licensed under the Apache 2.0 license.
- RunMat automatically optimizes your math for GPU execution on Apple, Nvidia, and AMD hardware. No code changes needed. Simulations that took hours now take minutes.
- Start running code in seconds. RunMat runs in the browser, on the desktop, or from the CLI. No license server, no IT ticket.