January 2018
Intermediate to advanced
474 pages
10h 23m
English
We implement text generation LSTM in TensorFlow with the following steps:
batch_size = 128n_x = 5 # number of input wordsn_y = 1 # number of output wordsn_x_vars = 1 # in case of our text, there is only 1 variable at each timestepn_y_vars = text8.vocab_lenstate_size = 128learning_rate = 0.001x_p = tf.placeholder(tf.float32, [None, n_x, n_x_vars], name='x_p') y_p = tf.placeholder(tf.float32, [None, n_y_vars], name='y_p')
For input, we are using the integer representations of the words, hence n_x_vars is 1. For output we are using one-hot encoded ...
Read now
Unlock full access