dlnetwork — Create a dlnetwork compatibility object for supported feed-forward layers.
dlnetwork(layers) converts a supported layer collection or layerGraph object into a RunMat dlnetwork compatibility object with layer metadata, learnables, state, and input/output names.
Syntax
net = dlnetwork(layers)
net = dlnetwork(graph)
net = dlnetwork(layers, 'Initialize', false)How dlnetwork works
- Accepts a layer object, a cell array of layer objects, an object list, or a
layerGraphobject. - Materializes
Layers,LayerNames,InputNames,OutputNames,Connections,Learnables,State, andInitializedmetadata. - Supports forward execution for sequential feed-forward networks made from
featureInputLayer,fullyConnectedLayer,reluLayer,eluLayer,softmaxLayer,classificationLayer, andregressionLayer. fullyConnectedLayerweights and bias are preserved when supplied. Missing weights are initialized deterministically from the preceding feature width, and missing bias values default to zeros.dlnetwork(layers,'Initialize',false)preserves the uninitialized metadata state and does not synthesize missing learnables;forwardthen raises a clear error until required weights and bias are present.- When passed through
dlfeval, supported fully-connected learnables are traced sodlgradientcan return matching learnables-gradient trees for custom training loops. - Recurrent, convolutional, normalization, sequence, image input, branching DAG execution, custom layers, and provider-resident training remain separate Deep Learning infrastructure work and raise explicit compatibility errors in this slice.
GPU memory and residency
dlnetwork construction is host metadata work. Forward execution currently gathers plain gpuArray inputs to host outside autodiff. GPU-backed dlarray autodiff is rejected with an explicit provider-gap error until Deep Learning tape kernels are implemented in the acceleration provider.
Example
Create a feed-forward network object
layers = {featureInputLayer(2,'Name','in'); fullyConnectedLayer(3,'Name','fc'); reluLayer('Name','relu')};
net = dlnetwork(layers)Expected output:
net is a dlnetwork compatibility object with initialized learnables.Using dlnetwork with coding agents
Open a RunMat example with live inputs, then ask the agent to explain how dlnetwork changes the result.
Run a small dlnetwork example, explain the result, then change one input and compare the output.
Related Deep Learning functions
adamupdate · analyzeNetwork · bilstmLayer · classificationLayer · combvec · convolution1dLayer · crossentropy · dlarray · dlfeval · dlgradient · dlupdate · eluLayer · exportONNXNetwork · featureInputLayer · forward · fullyConnectedLayer · globalAveragePooling1dLayer · layerGraph · layerNormalizationLayer · lstmLayer · padsequences · regressionLayer · reluLayer · sequenceInputLayer · softmaxLayer · trainingOptions · trainnet · trainNetwork
Open-source implementation
Unlike proprietary runtimes, every RunMat function is open-source. Read exactly how dlnetwork is executed, line by line, in Rust.
- View the source for dlnetwork in Rust on GitHub
- Learn how the RunMat runtime works
- Found a bug? Open an issue with a minimal reproduction.
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.