Recurrent Neural Networks (RNNs) for Language Modeling with Keras
David Cecchini
Data Scientist
The simpleRNN
cell can have gradient problems.
GRU
and LSTM
cells don't have vanishing gradient problems
# Import the layers
from tensorflow import keras
from tensorflow.keras.layers import GRU, LSTM
# Add the layers to a model
model.add(GRU(units=128, return_sequences=True, name='GRU layer'))
model.add(LSTM(units=64, return_sequences=False, name='LSTM layer'))
Recurrent Neural Networks (RNNs) for Language Modeling with Keras