且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Python Keras如何在将卷积层转换为lstm层后更改输入的大小

更新时间:2023-12-03 11:22:34

您可以在两者之间添加Reshape()层以使尺寸兼容.

You can add Reshape() layer in between to make dimensions compatible.

http://keras.io/layers/core/#reshape

keras.layers.core.Reshape(dims)

将输出重塑为特定形状.

Reshape an output to a certain shape.

输入形状

任意,尽管输入形状中的所有尺寸都必须固定.在将此层用作模型的第一层时,请使用关键字参数input_shape(整数元组,不包括示例轴).

Arbitrary, although all dimensions in the input shaped must be fixed. Use the keyword argument input_shape (tuple of integers, does not include the samples axis) when using this layer as the first layer in a model.

输出形状

(batch_size,) + dims

参数

dims:目标形状.整数元组,不包括样本维度(批量大小).

dims: target shape. Tuple of integers, does not include the samples dimension (batch size).