'Is there a way to get the real sequence_length in the model description of a RNN/LSTM in Keras?
I would like to get to know the real sequence_length in Keras for a LSTM/RNN. Unfortunately, when I print the model I only get None
all the time as a value. Here is a part of the code:
model = keras.models.Sequential([
keras.layers.SimpleRNN(iteration_NN_L1, return_sequences=True, input_shape=[None, numberOfInputFeatures]),
keras.layers.SimpleRNN(iteration_NN_L2, return_sequences=True),
keras.layers.Conv1D(160, kernel_size=3, strides=2),
keras.layers.Dense(numberOfOutputNeurons)
])
print(model.summary())
This leads to the following output:
Layer (type) Output Shape Param #
=================================================================
simple_rnn_48 (SimpleRNN) (None, None, 5) 45
_________________________________________________________________
simple_rnn_49 (SimpleRNN) (None, None, 5) 55
_________________________________________________________________
conv1d_23 (Conv1D) (None, None, 160) 2560
_________________________________________________________________
dense_22 (Dense) (None, None, 1) 161
=================================================================
Total params: 2,821
Trainable params: 2,821
Non-trainable params: 0
So both for the batchsize and the sequence length I always get None and I would like to know if there is a way to get the real output of layer in a Sequential RNN/LSTM model.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|