Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
1.0k views
Welcome To Ask or Share your Answers For Others

1 Answer

Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...