Training the neural net on MNIST data of handwritten digits