Recipe
Forward pass through a network
Use when: you are given a network's full architecture -- every layer's weights, biases, and activation -- along with its input, and need the network's final output
Goal: the output of every layer, ending with the network's prediction, \mathbf{a}^{(L)}
Taught in The forward pass, one layer at a time
Quick recipe
- Start with the network's own input as layer 1's input
- Multiply the current layer's weights by its input, one neuron at a time
- Add the products, then add the bias, to get \mathbf{z}
- Apply the layer's activation function to get \mathbf{a}
- Hand this layer's \mathbf{a} to the next layer as ITS input
- Repeat for every remaining layer; report the last layer's output
-
1
Set \mathbf{a}^{(0)} = \mathbf{x}, the network's actual input values.
Example
\mathbf{a}^{(0)} = (2, 3).
Why: every layer after the first reads the layer before it, never the network's raw input directly, so the chain has to start somewhere concrete.
-
2
For every neuron in the layer, multiply each of its weights by the matching entry of the layer's input.
Example
Layer 1, neuron A: 0.5 \times 2 and 0.2 \times 3.
Why: each neuron's own weights only ever multiply that neuron's own copy of the shared input, never another neuron's.
-
3
Sum each neuron's products, then add that neuron's own bias.
Example
Neuron A: 1 + 0.6 + 1 = 2.6. Neuron B: -2 + 1.2 + 0 = -0.8. Layer 1's \mathbf{z} = (2.6, -0.8).
Why: this is Chapter 3's W\mathbf{x}+\mathbf{b}, every neuron in the layer computed at once.
-
4
Apply \phi to every entry of \mathbf{z}, one at a time.
Example
\sigma(2.6) \approx 0.931, \sigma(-0.8) \approx 0.310. Layer 1's output \mathbf{a} \approx (0.931, 0.310).
- this layer is hidden, or the task wants a bounded output — apply the sigmoid (or whichever activation the layer specifies).
- this is the very last layer and the task wants a raw number — some networks apply no further function here; \mathbf{a}^{(L)} = \mathbf{z}^{(L)}.
Why: Chapter 2 showed that without this step, any number of stacked layers collapses to one plain weighted sum.
-
5
Whatever this layer just produced becomes the very next layer's \mathbf{a}^{(l-1)} — never the network's original input again.
Example
Layer 2 reads (0.931, 0.310), not (2, 3).
Why: this is the one fact that makes a forward pass a CHAIN and not L separate, unrelated computations.
-
6
Run steps 2 through 5 again for the next layer, and the next, until the last layer is reached. Its output is the network's prediction.
Why: a network with L layers has run this exact four-step routine L times when it finishes, once per layer, never more and never fewer.
Common mistakes
- Applying the activation function a second time to a value that has already been activated, instead of passing it straight to the next layer's weighted sum.
- Forgetting one layer's bias while remembering another's, especially the output layer's, since it is the last number added before the pass moves on.
- Feeding a layer the network's original input instead of the layer immediately before it — every layer past the first reads its own predecessor's OUTPUT, never the raw x_1, x_2 again.