I know that for many applications a RNN (e.g. LSTM) needs a 3-dimensional input structure with [Batchsize, Sequence_Length, Features]. My question is if you also need a 3-dimensional input vector when making a "Point-To-Point" forecast, as classified here https://stackoverflow.com/questions/42334335/how-to-structure-an-lstm-neural-network-for-classification under "one to one"? In that case, the sequence length would just be 1 which would theoretically remove this dimension as far as I understand.


1 Answer 1


Implementation-wise, the fact that the input and output sequence length is 1 is determined only by the data and does not affect the network architecture, so the accepted dimensionality of the input tensors is the same.

  • $\begingroup$ Thanks Noe for your answer. Maybe one follow up question: What about the output dimensionality? Does a LSTM always output a 3-dimensional vector? As far as I understand it depends on wether you use return_sequences=True in the keras code and if you use a keras.layers.TimeDistributed. So if you use them, then the output is a 3-dimensional vector. If you don't use them, the output might also be 2-dimensional. Is that right and did I misunderstand something? $\endgroup$
    – PeterBe
    Dec 12, 2023 at 12:56
  • 1
    $\begingroup$ Yes, in case of return_sequences=True, Keras returns a 3D tensor, while with return_sequences=False it returns a 2D tensor. $\endgroup$
    – noe
    Dec 12, 2023 at 14:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.