October 2018
Intermediate to advanced
252 pages
6h 49m
English
RNN = layers.LSTMHIDDEN_SIZE = 128BATCH_SIZE = 128LAYERS = 1
print('Build model:')model = Sequential()# "Encode" the input sequence using an RNN, producing an output of HIDDEN_SIZE.# Note: For situation where input sequences have a variable length,# use input_shape=(None, num_feature).model.add(RNN(HIDDEN_SIZE, input_shape=(MAXLEN, len(chars))))model.add(layers.RepeatVector(DIGITS + 1))for _ in range(LAYERS): model.add(RNN(HIDDEN_SIZE, return_sequences=True))model.add(layers.TimeDistributed(layers.Dense(len(chars))))model.add(layers.Activation('softmax'))