0
votes

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?

1

1 Answers

1
votes

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.