我有一个像这样的神经网络:
model = Sequential()
model.add(Conv1D(100, 10, activation='relu', batch_input_shape=25)))
model.add(Conv1D(100, 10, activation='relu'))
model.add(MaxPool1D(3))
model.add(Conv1D(160, 10, activation='relu'))
model.add(GlobalAveragePooling1D())
model.add(layers.Dense(60))
我的生成器生成形状为(20,60,1)的批量目标。我有两个问题。
ValueError: Error when checking target: expected dense_1 to have 2 dimensions, but got array with shape (20, 60, 1)
当我这样做
model.add(layers.Reshape((20,60,1)))
我收到以下错误:
ValueError: Cannot reshape a tensor with 1200 elements to shape [20,20,60,1] (24000 elements) for 'reshape_1/Reshape' (op: 'Reshape') with input shapes: [20,60], [4] and with input tensors computed as partial shapes: input[1] = [20,20,60,1].
为什么它会尝试执行这样的重塑?