terminix00
terminix00

Reputation: 337

LSTM with variable sequences & return full sequences

How can I set up a keras model such that the final LSTM layer outputs a prediction for each time step while having variable sequence lengths as input?

I'd then like to provide labels for each of the timesteps after a dense layer with linear activation.

When I try to add a reshape or a dense layer to the LSTM model that is returning the full sequence and has a masking layer to take care of variable sequence lengths, it says:

The reshape and the dense layers do not support masking.

Would this be possible to do?

Upvotes: 0

Views: 804

Answers (1)

tao_oat
tao_oat

Reputation: 1037

You can use the TimeDistributed layer wrapper for this. This applies the layer you want to each timestep. In your case, you could also just use TimeDistributedDense.

Upvotes: 1

Related Questions