Convolutional neural networks using TensorFlow

In this section, we will build a TensorFlow model on the MNIST dataset. The code has similar layers and parameters to the Lenet model that we saw in Chapter 5, Image Classification Using Convolutional Neural Networks. However, the code to build the model in TensorFlow is more complicated than the code to build the model in Keras or in MXNet. One reason for this is that it is the programmer's job to ensure that the sizes of the layers are correctly aligned. In the Keras/MXNet models, we can just change the number of nodes in a layer in one statement. In TensorFlow, if we change the number of nodes in a layer, we must ensure that we also change the inputs in the next layer.

In some ways, programming ...

Get Deep Learning with R for Beginners now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.