首页 > 解决方案 > LSTM 层输出大小与 KERAS 中的隐藏状态大小

问题描述

我无法理解 LSTM 的概念并在 Keras 上使用它。在考虑 LSTM 层时,输出大小和隐藏状态大小应该有两个值。

1. hidden state size : how many features are passed across the time steps of a samples when training the model
2. output size       : how many outputs should be returned by particular LSTM layer

但在 keras.layers.LSTM 中,只有一个参数,用于控制层的输出大小。

问题:

Therefore how hidden state size of the LSTM layer can be changed?

如果我被误解,更正非常感谢。

标签: tensorflowkeraslstmrecurrent-neural-network

解决方案


您对 LSTM 中隐藏单元和输出单元的差异感到困惑。请参阅以下链接以获得更好的清晰度:

https://jasdeep06.github.io/posts/Understanding-LSTM-in-Tensorflow-MNIST/

基本上你在 num_units 中提供的只是 LSTM 隐藏单元的大小。从这篇文章中可以很清楚地看到这一点。


推荐阅读