Note: All the code has been written by me.
A small neural network that recognizes handwritten digits, written with nothing but NumPy. No PyTorch, no TensorFlow. Forward pass, backpropagation and gradient descent are all done by hand.
It gets 90.5% accuracy on the MNIST test set.

How it works
The network has two layers: 784 inputs (one per pixel), 10 hidden neurons with ReLU, and 10 outputs with softmax.
Forward pass:
Backward pass (with one-hot labels and training examples):
Then every parameter is updated with .
I trained it with full-batch gradient descent on all 60,000 training images, learning rate 0.5, for 500 iterations. It takes about 10 seconds on a laptop.
Results
Predictions on test images (wrong ones in red):

Most mistakes happen between digits that look alike, like 4 and 9 or 3 and 5:

The first-layer weights of each hidden neuron, reshaped back into 28x28 images:

Running it
pip install -r requirements.txt
python mnist.py
You need the MNIST CSV files in dataset/ first. See dataset/README.md for where to get them.