Defining a loss function in our MNIST example