Skip to content
ML to LLMs
Labs / Neural Network Lab

Neural network forward pass

Change weights and activations in a 2-3-1 network and follow every number and tensor shape.

Theory and worked examples: The neural-network forward pass

Forward pass lab

A fully connected network. Click any weight (line) to edit it, or any hidden neuron to see its arithmetic.

Neural network diagramW1[h1, x1] = 0.5W1[h1, x2] = -1W1[h2, x1] = 1W1[h2, x2] = 1W1[h3, x1] = -0.5W1[h3, x2] = 0.25W2[y1, h1] = 1W2[y1, h2] = -0.5W2[y1, h3] = 21.0x12.0x2z -1.50a 0.00z 2.00a 2.00z 0.50a 0.500.562ŷinput [2]hidden [3]output [1]

Blue lines are positive weights, orange are negative; thickness is magnitude. Hidden-neuron shading shows activation size; the green outline marks the neuron whose arithmetic is shown below.

Hidden neuron h1: z=0.50⋅1.00+(−1.00)⋅2.00+0.00=−1.500z = 0.50 \cdot 1.00 + (-1.00) \cdot 2.00 + 0.00 = -1.500, then a=max⁡(0,z)=0.000a = \max(0, z) = 0.000.

ReLU outputs exactly 0 for 1 hidden neuron(s) right now, so their outgoing weights have no effect on this input. The output uses a sigmoid, giving a probability for the positive class.