Stateful RNN issues

Hey folks,

Hoping to get some support from the community! Been trying to mess around with LSTMs and I can’t it to predict anything when it’s stateful. When I set stateful to False and get rid of batch_input_shape, this exact code ends up working so not sure how to get the stateful LSTMs to get me predictions.

Here’s the code and error I’m getting: https://gist.github.com/nemo/da1dc7a3daef5b1e446deefad04ae807

Any ideas?

Could you update your gist so that it uses the imdb dataset from lesson 5 - that way we can replicate your issue ourselves and help debug it. I can’t see the problem at first glance, but then I’ve got a bad cold so not at my best! But if I can replicate it locally I’ve got a better chance…

Updated!

Note that I’m making sure to just convert the imdb data to the same format that I have my data, so essentially the data prep is exactly the same between them. I’m getting the same error with the imdb data.

1 Like

Please ping me if I don’t answer this in a couple of days - will try to find the time to look into it.

1 Like

Just wondering if we ever figured out a solution to this – I’m struggling with the same thing.

I think that it’s probably the same problem that I created this thread about - at the time I didn’t see that this one was relevant. My solution in the second post seems to work, ie. predicting using a derived model, with a batch size of 1 instead.