Building the TensorFlow graph

Constructing the TensorFlow graph is probably the most complex part of building a neural network. We will precisely examine all of the steps so you can obtain a full understanding. 

The TensorFlow graph can be viewed as a direct implementation of the recurrent neural network model, including all equations and algorithms introduced in Chapter 1Introducing Recurrent Neural Networks.

First, we start with setting the parameters of the model, as shown in the following example:

X = tf.placeholder(tf.float32, shape=[None, num_classes, 1])Y = tf.placeholder(tf.float32, shape=[None, num_classes])num_hidden_units = 24weights = tf.Variable(tf.truncated_normal([num_hidden_units, num_classes]))biases = tf.Variable(tf.truncated_normal([num_classes])) ...

Get Recurrent Neural Networks with Python Quick Start Guide 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.