added support for stochastic gradient descent to mnist example