RNN:Keras 框架中 LSTM 层中的 return_sequences 有什么用

RNN: What is the use of return_sequences in LSTM layer in Keras Framework

我在 RNN 工作。我有来自某个站点的以下代码行。 如果您观察到第二层没有 "returnSequence" 参数。

我假设 return 序列是强制性的,因为它应该 return 序列。 你能告诉我为什么没有定义吗?

第一层LSTM:

regressor.add(LSTM(units = 30, return_sequences = True))

第二层LSTM:

regressor.add(LSTM(units = 30))

return_sequences参数设置为False(默认)时,网络将只输出hn,即最后的隐藏状态时间步长。否则,网络将输出隐藏状态的完整序列,[h1, h2, ..., h n]。该层的内部方程没有改变。参考documentation.