How the LSTMCell take the input layout


If I use the input as following, it seems the h and c of LSTM should be like

input_d = nd.random.uniform(shape=(a,b,c))
layer = gluon.rnn.LSTMCell(hidden_size=100)
h0 = nd.random.uniform(shape=(a,c))
c0 = nd.random.uniform(shape=(a,c))
output, h1 = layer(input_d,[h0,c0])

but generally, we use input layout as (batch_size, seq_length, feature_dim) and I did not discover the layout attribute in LSTMCell, according to the above, the h and c are correspond to the batch_size, but its shape should correspond to the seq_length instead, right?

So my question is, is this a problem about the layout or I have some misunderstanding of the concept of LSTM?


Initial hidden state and cell value correspond to a single-cell (i.e. sequence length is always 0). Therefore their shape must be (batch_size, feature_dim), which is what LSTMCell expects.