A layer as a matrix

See one layer of neurons two ways at once: as a network diagram and as the matrix product Wx + b.

IntermediateExplained in Layers are matrix multiplications

A layer is a matrix multiplication

Each output neuron takes a weighted sum of the inputs plus a bias. Stack those weights in rows and you have a matrix.

1.0x₁0.5x₂−1.0x₃0.3z₁−0.8z₂0.5z₃1.4z₄

positive weightnegative weightThicker means larger.

W
×
x
1.00.5−1.0
+
b
0.20.00.30.4
=
z
0.30−0.800.501.35

z₁ = (0.7)(1.0) + (−1.4)(0.5) + (−0.1)(−1.0) + 0.2 = 0.30

1.0
0.5
−1.0
ShapesW is 4 × 3, x has 3, b and z have 4
Neuron 1 output z₁0.30

Try this

  • Select an output neuron and find its row of W. The highlighted lines and the highlighted row are the same weights.
  • Set all inputs to 0: every output becomes its bias.
  • Press New weights and confirm the shapes never change.

Try "embedding", "softmax", "overfitting", or "backpropagation".