Three inputs, two regions, one network
numeric▲△△Every value here is exact; all are printed to 4 d.p. so they line up with the reproduction snippet.
STATEMENT
Push three inputs through the same two-layer network. Report the pre-activations, the activations and the output for each, and then answer the question the numbers are really for: which of the three inputs are processed by the same affine map, and how you can tell without computing the output at all.
GIVEN
Two inputs, three hidden ReLU units, one output. Row-major throughout (Vectors, matrices and the row-major convention 0.LA.01), so a layer is applied on the right.
The three inputs:
FIND
For each input: , , the activation pattern, and . Then the effective affine map that the network applies on each pattern.
STRATEGY
Compute the pre-activations first and read the pattern off their signs, before touching the second layer. The pattern is what decides everything that follows, so getting it in hand early turns the rest into arithmetic.
SOLUTION
Step 1 — the pre-activations for . This is the first half of one step of (I.5.1): each entry of pairs with one column of .
So and the activation pattern is — units one and two on, unit three off.
Step 2 — activation and output. , and
Step 3 — the second input. , pattern again, and .
Step 4 — the third input. , pattern , , and .
Step 5 — the map each pattern selects. Write the pattern as a diagonal matrix of ones and zeros. Then ReLU has been replaced by a fixed linear map, and the whole network collapses on that region into equation (I.5.3):
For :
so on that region . For : , , , giving .
Step 6 — the answer to the question actually asked. and share the pattern , so they share one affine map; does not. You can tell from the signs of alone, which is three inner products — the second layer never enters the decision.
Answer
| input | pattern | map on that region | ||
|---|---|---|---|---|
The first two inputs lie in one linear region and the third in another.
Check — numeric · i-5-b01-activation-pattern.py
def forward(x):
z = [sum(x[i] * W1[i][j] for i in range(2)) + b1[j] for j in range(3)]
a = [max(0.0, t) for t in z]
return z, a, sum(a[j] * W2[j] for j in range(3)) + b2Prints the three patterns , , , the outputs , , , and each region’s affine map — which it then evaluates directly, as a second route to the same output.
Executed in CI. The digits above are the digits it printed.
Check — sanity
The effective map reproduces the output. On the region , and . Two different inputs, one formula, the right answers. That is the content of a linear region stated as an arithmetic check.
The dead unit cannot matter. Unit three is off for , so the third entry of — the value — cannot influence . Change it to and recompute: still .
The second coordinate genuinely drops out. On region the coefficient of is exactly zero, so moving to should not change the output as long as the pattern holds. Check the pattern first: , still , and . It does not change.
Where this breaks
The whole calculation assumes the pattern is read at the given input. It is not a property of the network — it is a property of the network and the input together. A common mistake is to speak of “the dead units” of a model as though the set were fixed; unit three is off here and on for , where . Only a unit off for every input in the dataset is dead in the sense of I.3, and that is a much stronger and much rarer claim.
Variation
Find an input for which all three units are on, then one for which all three are off — or show that the second is impossible. I.5.X01 does exactly this by exhaustion, so try it by hand first.