We build the LeNet layers required for inference by calling the build_mnist_lenet method in our script:
# Build the LeNet network
softmax_layer = build_mnist_lenet(train_model, data)
Note how we only pass in the image pixel data input to this network and not the labels. The labels are not required for inference; they are required for training or testing to use as ground truth to compare against the prediction of the network’s final layer.
The remainder of the following subsections describe how we add pairs of convolution and pooling layers, the fully connected and ReLU layers, and the final SoftMax layer, to create the LeNet network.