Approximating multiplication with a 2-layer ReLU MLP (2D box) #
This file gives a constructive, fully proved approximation result:
on $[-M,M]^2$, the function $(x_0,x_1)\mapsto x_0x_1$ can be uniformly approximated by a
single-hidden-layer
ReLU MLP on Tensor ℝ (.dim 2 .scalar).
TensorVec specialized to the 2D (rank-2) tensor-vector shape.
Instances For
First coordinate projection for PlaneTensorVec.
Instances For
Second coordinate projection for PlaneTensorVec.
Instances For
The closed box domain $[-M,M]\times[-M,M]$ inside PlaneTensorVec.
Instances For
The target multiplication map: multiply the two coordinates.
Instances For
Ridge direction with dot wPlus x equal to the sum of the two coordinates.
Instances For
Ridge direction with dot wMinus x equal to the first coordinate minus the second.
Instances For
Evaluate the ridge wPlus: it sums the two coordinates.
Evaluate the ridge wMinus: $\operatorname{dot}(w_-,x)=x_0-x_1$.
Unpack the defining bounds of membership in box M.
If $x\in\operatorname{box}(M)$, then $x_0+x_1\in[-2M,2M]$.
If $x\in\operatorname{box}(M)$, then $x_0-x_1\in[-2M,2M]$.
Concatenate tensors along the leading dimension.
In this file, this is used to append the hidden-unit vectors of two subnetworks.
Instances For
Append two first-layer linear specs by appending their weight and bias tensors.
Instances For
Extract the j-th entry from a 1 × n tensor interpreted as a row matrix.
Instances For
Combine two scalar-output linear specs into one scalar-output spec on an appended hidden layer.
If the appended hidden vector is $[z_a;z_b]$, the resulting output layer computes $\gamma+\alpha\,\mathrm{out}_a(z_a)+\beta\,\mathrm{out}_b(z_b)$.
Instances For
Reading the left component from an appended hidden vector.
Reading the right component from an appended hidden vector.
Pointwise behavior of the ReLU activation on tensor-vectors.
Matrix-vector multiplication for a 1 × n matrix produces a single scalar coordinate.
Expand mlp_eval_nd into “bias + sum over hidden units” form.
This is the main normalization lemma used to prove that appendLinearSpec together with
combineOutput implements affine combinations of subnetworks.
Selecting the left block of a linear spec appended via appendLinearSpec.
Selecting the right block of a linear spec appended via appendLinearSpec.
Appending hidden units and wiring the output with combineOutput yields an affine combination.
Concretely, the combined network computes: $\gamma+\alpha\,\mathrm{net}_a(x)+\beta\,\mathrm{net}_b(x)$.
Uniform approximation of multiplication on $[-M,M]^2$ by a single-hidden-layer ReLU MLP.
The construction follows the classical reduction
$xy=((x+y)^2-(x-y)^2)/4$, combined with a one-dimensional ReLU approximator for square on
$[-2M,2M]$
that is lifted along the ridge directions wPlus and wMinus.