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 layerGraph object.
  • Materializes Layers, LayerNames, InputNames, OutputNames, Connections, Learnables, State, and Initialized metadata.
  • Supports forward execution for sequential feed-forward networks made from featureInputLayer, fullyConnectedLayer, reluLayer, eluLayer, softmaxLayer, classificationLayer, and regressionLayer.
  • fullyConnectedLayer weights 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; forward then raises a clear error until required weights and bias are present.
  • When passed through dlfeval, supported fully-connected learnables are traced so dlgradient can 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.

Open-source implementation

Unlike proprietary runtimes, every RunMat function is open-source. Read exactly how dlnetwork is executed, line by line, in Rust.

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.

Getting started · Benchmarks · Pricing

Download RunMat

Download RunMat for full performance, or use RunMat in your browser for zero setup.