Layers and the forward pass
Not met yet
A neural network is layers of neurons. A batch of examples is one row each, and a layer is a weighted sum for every neuron at once: X @ W + b, where W has one column per neuron and b one bias per neuron, added to every row. (n, k) @ (k, m) gives (n, m): the inner sizes must match, and NumPy never turns a matrix round for you. Each layer's output, after its activation, is the next layer's input.
Try it
main.pyOutput
Press Run and what your program prints shows up here.
Easy to get wrong
- Thinks @ turns a matrix round by itself when the shapes don't line up.
- Thinks @ multiplies two arrays number by number, like *.
- Thinks a layer's bias adds one number to each example (row), rather than one number to each neuron (column).