0

I got confuse about LSTM:

  1. In Keras(2.1.0+), is the 'units' means the number of cells in LSTM?
  2. The number of cells is time of step, or independence with sample's length? Is length of sample just equal the time of step?
  3. I think each cell output dim is 1, so the whole layer output is the combination of each cell, there have n cells so the output get n dim, am I wrong?

Thank you.

1 Answers1

0

This Answer explains the difference between LSTMs and LSTMCells.

  1. From the documentation:

units: Positive integer, dimensionality of the output space.

  1. The number of cells is independent of the number of timesteps. The number of timesteps is infered from the input shape.

  2. That is wrong. LSTMCell is just an Object that is used by the LSTM layer. It contains the calculation logic for all units.

sietschie
  • 7,425
  • 3
  • 33
  • 54
  • Thank you for your answer. But I still confuse about relationship between the dimensionality of the output space and the number of the units. Are they equal? Or they have any other relationship? If I get a input sample sentence as dim(500,1), and set the lstm units 128, so the number of visible units is 128? Or there is no longer visible units concept in lstm? – 一条汉子 Jan 18 '18 at 15:44
  • As the documentation states: it's the same. But what do you mean by "visible units"? – sietschie Jan 18 '18 at 18:48
  • Sorry, I mean hidden unit. In LSTM, is a `LSTMCell` contains hidden units? How to comprehand the hidden unit concept in LSTM? – 一条汉子 Jan 19 '18 at 00:38
  • I am not sure what you mean by 'hidden unit'. I know of hidden layers, which are just layers that are not the input or the output layer of a network or the hidden state of an lstm layer which will be of the same dimension as the output of the lstm? – sietschie Jan 19 '18 at 09:15
  • Thank you very much and I'm clearer now. Seems like LSTM encapsulate Cell to calculate and get specified dimensionality of the output through it's inside cacluation. – 一条汉子 Jan 19 '18 at 09:51