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
$\begingroup$
$\endgroup$
2
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 akeras.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$– PeterBeCommented Dec 12, 2023 at 12:56 -
1$\begingroup$ Yes, in case of
return_sequences=True
, Keras returns a 3D tensor, while withreturn_sequences=False
it returns a 2D tensor. $\endgroup$– noeCommented Dec 12, 2023 at 14:10