mlp2

std.nn.mlp2 · Level L0

Two-layer perceptron with a ReLU between the layers. Calls linear twice.

Y = relu(X·W₁ + b₁)·W₂ + b₂

Signature

mlp2(X: f64[m, k], W1: f64[k, h], b1: f64[h], W2: f64[h, n], b2: f64[n]) → f64[m, n]

Structure

The function as NOVA stores it: one box per input, operation and output, and arrows that carry values. A double border marks another library function this one runs — called once, or by Scan once per element; select it to open that function.

Xf64[m, k]W1f64[k, h]b1f64[h]W2f64[h, n]b2f64[n]linearHReluRlinearYYf64[m, n]
  • input
  • operation
  • constant
  • call
  • output

Verification

  • Signature proven by NOVA’s shape solver, for every size.
  • Equal to the reference np.maximum(X @ W1 + b1, 0) @ W2 + b2 in exact rational arithmetic, on all 40 test cases.
  • All 623 float64 results inside the running error bound; the closest uses 62% of it.
  • Interpreter and NumPy backend return bit-identical results.
Accuracy in detail
correctly rounded (the float64 nearest the exact value)
71%
bit-equal to the NumPy formula in float64
100%
largest error, in units in the last place
64

Large ulp counts appear where a result is tiny next to the numbers it is computed from (after cancellation, for example), so one unit in the last place is tiny too; the absolute error is still inside the bound. Results within their own error of zero are not counted.

Identity

Calls
Called by
—
sha256:15c1dbbe0e89904fbf01f9439cc4045edc9ee449d2168d26f56adadd1e0f4f7b

The semantic hash of the graph. It changes when the program changes, and never when only its documentation does.

Control handle

Symbol
Ω:std.nn.mlp2 · Ω:mlp2
Pins
sha256:659d35dbe12a8ac4aa0f149606fb0a97adc8a4b90a47b3b6c59a486ce56e44fdthis graph and the 1 it reaches through calls
Evidence
sha256:da421a739aa6550b4ba020e47fdbd17c21f28d90e56577522cab43caddc6cd71the hash of its verification record
Needs
no capability: a pure function

Through NOVA’s control layer, the symbol launches this function only while the program still matches what it pins: a change to this graph, or to any graph it reaches, needs a migration first.