Model definition

First, we will load the Python modules; in this case, the TensorFlow package and the hyperparameters that we defined previously:

import tensorflow as tfimport hy_param

Then, we define the placeholders that we will be using to input data into the model. tf.placeholder allows us to feed input data to the computational graph. We can define constraints with the shape of the placeholder to only accept a tensor of a certain shape. Note that it is common to provide None for the first dimension, which allows us to the size of the batch at runtime.

Master your craft: Batch size can often have a big impact on the performance of deep learning models. Explore different batch sizes in this project. What changes as a result? What's your ...

Get Python Deep Learning Projects 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.