forward — Run a supported dlnetwork forward pass.

forward(net,X) evaluates a RunMat dlnetwork compatibility object over numeric predictor data.

Syntax

Y = forward(net, X)

How forward works

  • Supports sequential feed-forward networks made from featureInputLayer, fullyConnectedLayer, reluLayer, eluLayer, softmaxLayer, classificationLayer, and regressionLayer.
  • Numeric matrix inputs are interpreted as observations in rows and predictors in columns.
  • dlarray inputs are unwrapped for normal execution, and the output is wrapped back into a dlarray preserving the input format metadata.
  • Inside dlfeval, host dlarray inputs and supported dlnetwork learnables are traced through fully-connected, ReLU, ELU, and softmax layers so scalar losses can be differentiated by dlgradient.
  • Name-value execution options, recurrent state outputs, branching DAG execution, custom layers, GPU-backed dlarray execution, and provider-resident autodiff are not implemented in this slice and raise explicit compatibility errors.

GPU memory and residency

forward currently gathers plain provider-resident gpuArray inputs to host before evaluating the supported layer chain outside autodiff. GPU-backed dlarray inputs are rejected before gather because native Deep Learning provider execution and tape kernels remain future acceleration work.

Example

Evaluate a feed-forward dlnetwork

layers = {featureInputLayer(2,'Name','in'); fullyConnectedLayer(2,'Name','fc'); softmaxLayer('Name','prob')};
net = dlnetwork(layers);
y = forward(net, [1 2; 3 4])

Expected output:

y is a numeric matrix with one row per observation.

Using forward with coding agents

Open a RunMat example with live inputs, then ask the agent to explain how forward changes the result.

Run a small forward 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 forward 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.