A tiny network has input x=(1,2), two hidden units with h1=ReLU⁡(x1+x2−2) and h2=ReLU⁡(−x1+x2−2), and a linear output y^=2h1+3h2+1. Here ReLU⁡(z)=max⁡(0,z). Compute the hidden values, the output y^, and the squared error (y^−y)2 for the target y=5?

Deep learning, Multilayer perceptrons
Level L2 Elementary. Length Short. Nature Mat Mathematical.

What's being asked

Whether you can run a forward pass by hand: weighted sum, activation, next layer, then the loss.

Key idea

A forward pass computes each layer in order. For each unit, form the weighted sum plus bias (the pre-activation z), apply the activation, and feed the results to the next layer. ReLU keeps positive values and turns negative ones into 0.

Steps

  1. Hidden unit 1, pre-activation: z1=1+2−2=1. After ReLU, h1=1.
  2. Hidden unit 2, pre-activation: z2=−1+2−2=−1. After ReLU, h2=max⁡(0,−1)=0.
  3. Output: y^=2(1)+3(0)+1=3.
  4. Loss with y=5: (3−5)2=4.
  5. Note what ReLU did: hidden unit 2 is switched off for this input, so its output weight 3 had no effect on the prediction.

Common mistakes

How long your answer should be

About 2 minutes: five short lines of arithmetic.

Read this

Previous in Deep learning: A network has two layers with no activation function. Layer 1 is h=W1x+b1 with W1=[1201], b1=(1,0)⊤. Layer 2 is y^=W2h+b2 with W2=[2011], b2=(0,1)⊤. What single layer W′x+b′ does the same job, and does it agree with the two layers at x=(1,1)⊤?
Next in Deep learning: How do you derive the gradient of the softmax cross-entropy loss with respect to the logits?