Training

Initialize and train a TensorFlow neural network using actual training data.

Chapter Goals:

  • Learn how to feed data values into a neural network
  • Understand how to run a neural network using input values
  • Train the neural network on batched input data and labels

A. Running the model

In this chapter and the next, you will be running your model on input data, using a tf.compat.v1.Session object and the tf.compat.v1.placeholder variables from the previous chapters.

The tf.compat.v1.Session object has an extremely important function called run. All the code written in the previous chapters was to build the computation graph of the neural network, i.e. its layers and operations. However, we can only train or evaluate the model on real input data using run. The function takes in a single required argument and a few keyword arguments.

B. Using run

The required argument is normally either a single tensor/operation or a list/tuple of tensors and ...