The workflow to define and train a simple RNN in TensorFlow is as follows:
- Define the hyper-parameters for the model:
state_size = 4
n_epochs = 100
n_timesteps = n_x
learning_rate = 0.1
The new hyper-parameter here is the state_size. The state_size represents the number of weight vectors of an RNN cell.
- Define the placeholders for X and Y parameters for the model. The shape of X placeholder is (batch_size, number_of_input_timesteps, number_of_inputs) and the shape of Y placeholder is (batch_size, number_of_output_timesteps, number_of_outputs). For batch_size, we use None so that we can input the batch of any size later.
X_p = tf.placeholder(tf.float32, [None, n_timesteps, n_x_vars],
name='X_p')
Y_p = tf.placeholder(tf.float32, [None, n_timesteps, n_y_vars],
name='Y_p')
- Transform the input placeholder X_p into a list of tensors...