Skip to Content
Deep Learning Quick Reference
book

Deep Learning Quick Reference

by Mike Bernico
March 2018
Intermediate to advanced
272 pages
7h 53m
English
Packt Publishing
Content preview from Deep Learning Quick Reference

Network architecture

Our network will use two Keras LSTM layers, each with 100 LSTM units:

inputs = Input(batch_shape=(batch_shape, sequence_length,                input_dim), name="input")lstm1 = LSTM(100, activation='tanh', return_sequences=True,              stateful=True, name='lstm1')(inputs)lstm2 = LSTM(100, activation='tanh', return_sequences=False,              stateful=True, name='lstm2')(lstm1)output = Dense(1, activation='tanh', name='output')(lstm2)

Pay special attention to the return_sequences argument. When connecting two LSTM layers, you need the previous LSTM layer to output predictions for each time step in the sequence so that the input for the next LSTM layer is three-dimensional. Our Dense layer, however, only needs a two-dimensional output in order to predict ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Keras Deep Learning Cookbook

Keras Deep Learning Cookbook

Rajdeep Dua, Sujit Pal, Manpreet Singh Ghotra
Deep Learning with Keras

Deep Learning with Keras

Antonio Gulli, Sujit Pal

Publisher Resources

ISBN: 9781788837996Supplemental Content