How to feed into LSTM with 4 dimensional input?

末鹿安然 提交于 2019-12-01 17:35:51

The answer is you can't.

The Keras Documentation provides the following information for Recurrent Layer:

Input shape

3D tensor with shape (batch_size, timesteps, input_dim).

In your case you have 64 timesteps where each step is of shape (100, 50). The easiest way to get the model working is to reshape your data to (100*50).

Numpy provides an easy function to do so:

X = numpy.zeros((6000, 64, 100, 50), dtype=numpy.uint8)
X = numpy.reshape(X, (6000, 64, 100*50))

Wheter this is reasonable or not highly depends on your data.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!