This example shows you how to train MNIST (using the layers block).
This model will compute accuracy over 1000 random test set examples every 5 steps, plotting loss and accuracy as the model is training.
Training time can be reduced by computing accuracy over fewer examples less often.
The block algorithm was created referring to this( https://github.com/tensorflow/tfjs-examples/tree/master/mnist ) source.