Ask Your Question
1

What is the meaning of using a Keras Dense layer following an LSTM with return_sequence=True?

asked 2023-04-30 17:01:26 +0000

ladyg gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
4

answered 2023-04-30 17:27:02 +0000

huitzilopochtli gravatar image

When using an LSTM (Long Short-Term Memory) layer in Keras with return_sequences=True, the output of each time step is returned rather than just the final output. Thus, the output shape of the LSTM layer will be (batch_size, timesteps, output_dim).

In this context, adding a Dense layer following the LSTM layer allows for further processing of the output of each time step. The Dense layer applies a linear transformation to each time step's output separately, and can be thought of as a fully connected layer that maps the input features to the output classes.

Overall, this architecture is commonly used in sequential data problems where we want to model the whole sequence, such as time-series forecasting or sequence classification.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2023-04-30 17:01:26 +0000

Seen: 21 times

Last updated: Apr 30 '23