How to do it...

We proceed with the recipe as follows:

  1. We will start by declaring a batch size. This will be how many data observations we will feed through the computational graph at one time:
batch_size = 20
  1. Next, we declare the data, placeholders, and variable in the model. The change we make here is that we change the shape of the placeholders. They are now two dimensions, where the first dimension is None and the second will be the number of data points in the batch. We could have explicitly set it to 20, but we can generalize and use the None value. Again, as mentioned in Chapter 1, Getting Started with TensorFlow, we still have to make sure that the dimensions work out in the model, and this does not allow us to perform any illegal ...

Get TensorFlow Machine Learning Cookbook - Second Edition 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.