Keras - 如何通过摆脱最后三个维度将 5d 张量变成 3d 张量?

Keras - How do I turn a 5d Tensor into a 3d one by getting rid of the last three dimensions?

在 Keras 中,我有一个从层输出的 (100, 200, 300, 400, 500) Tensor,我想在喂它之前把它变成一个 (100, 200, 300*400*500) Tensor进入一个新的层。我该怎么做?

尝试添加一个keras.layers.Reshape层:

from keras.layers import Reshape

# ...
model.add(Reshape((100,200,300*400*500)))
# ...

model.add(Reshape((-1,200,300*400*500)))

假设第一个维度是batch size,你忽略它:

model.add(Reshape(200,300*400*500))