C++ version of MNIST benchmark.