更新时间:2023-12-03 11:13:46
您可以在中间添加 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
:目标形状.整数元组,不包括样本维度(batch size).
dims
: target shape. Tuple of integers, does not include the samples dimension (batch size).