When does keras reset an LSTM state?

后端 未结 5 1437
逝去的感伤
逝去的感伤 2020-11-28 04:23

I read all sorts of texts about it, and none seem to answer this very basic question. It\'s always ambiguous:

In a stateful = False LSTM layer, does ker

5条回答
  •  有刺的猬
    2020-11-28 04:57

    In the doc of the RNN code you can read this :

    Note on using statefulness in RNNs :

    You can set RNN layers to be 'stateful', which means that the states computed for the samples in one batch will be reused as initial states for the samples in the next batch. This assumes a one-to-one mapping between samples in different successive batches.

    I know that this doesn't answer directly your question, but to me it confirms what I was thinking : when a LSTM is not stateful, the state is reset after every sample. They don't work by batches, the idea in a batch is that every sample is independant from each other.

    So you have 1000 reset of the state for your example.

提交回复
热议问题