writing generative model code starting with the xor example for debugging and eventually running on MNIST