Reputation: 2240
If I build and train my RNN based model with stateful=False, can I simply do (e.g.):
model.layers[0].stateful = True
And have it take effect as might be expected for use in prediction? I ask because in other situations (learning rate for example), the exposed parameters are "cosmetic" and don't actually affect behavior.
Upvotes: 4
Views: 216
Reputation: 11
If your model is not stateful, model resets the state variable after each batch. You can create a stateful model but manually reset the state variable after each batch in prediction using callbacks (model.reset_states after on_batch_end callback).
Also, why do you want to change statefulness after training ?
Upvotes: 1