# Clarifications regarding LSTM

from keras.models import Sequential
from keras.layers import Dense
from keras.layers import LSTM

net = Sequential()
net.add(LSTM(units = 3, return_sequences = True, input_shape = (X_train.shape[1], 1)))

Below image is an attempt to visually represent the above code snippet.

From the above figure, I understand that there are two layers of LSTM units. Each of those layers has three LSTM units/neurons. There is a single output neuron/unit. The same input is fed to all three LSTM units in the first layer.

My Questions:

a) Does the figure interpret the code sample correctly?

b) Have I described/understood the figure correct?

Thank you!

I've sketched a picture of your code given a sequence on 4 input elements ($x_1, x_2, x_3, x_4$). Each row represents a single LSTM layer. Each LSTM block contains 3 units/neurons. Within the block neurons are connected and can exchange information between sequence steps.
• LSTM block would be a a cube on the graph. Typically LSTM block has more than one neuron inside. Say in your example on 3 neurons, when you are computing, say, forget gate $f_t$ then all hidden state variables $h_(t-1)$ are considered for each neuron. Does that make sense? – Tautvydas Sep 10 '18 at 13:27