Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.0k views
in Technique[技术] by (71.8m points)

keras - What Happens When LSTM Hidden Layer Size is Greater Than Input Sequence Length?

I have this bidirectional LSTM model defined in Python using Keras.

hidden_size = 128
    model = Sequential()
    model.add(Bidirectional(LSTM(hidden_size, return_sequences=True), input_shape=(30,21), merge_mode="concat"))
    model.add(Bidirectional(LSTM(hidden_size, return_sequences=False), merge_mode="concat"))
    model.add(Dense(2, activation='softmax'))
    model.summary()

To clarify, my input size is 30 characters of a sequence, each character encoded by a 21-dimensional vector.

Here is my question: How is the model able to train and operate properly when the input size of 30 is less than the hidden size of 128? Do the first 30 LSTM cells get input character (21-dimensional encoding) and the other 98 cells only receive hidden states?

I would greatly appreciate either a diagram to explain how the data is flowing through my specific architecture or just a detailed explanation.

Thanks in advance!

question from:https://stackoverflow.com/questions/65836122/what-happens-when-lstm-hidden-layer-size-is-greater-than-input-sequence-length

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...