Keras,ValueError:输入0与层conv1d_1不兼容:预期的ndim = 3,找到的ndim = 2

时间:2019-02-25 16:31:52

标签: python keras neural-network

model = Sequential()
model.add(Embedding(input_dim= vocab_size,
                    output_dim= 100,
                    input_length = max_len,
                    batch_input_shape=(200,9200)))

model.add(LSTM(100,batch_input_shape = (200, 9611, 100), return_sequences = True, stateful = True))
model.add(Dropout(0.5))
model.add(Flatten())
model.add(Conv1D(32, (5), kernel_regularizer=regularizers.l1(0.001), activation='relu'))
model.add(MaxPooling1D(pool_size=4))
model.add(Dense(1,kernel_regularizer=regularizers.l1(0.001), activation='sigmoid'))

我的x_train的形状是(9611,9200),而y_train的形状是(9611,)。

但是我不断得到ValueError: Input 0 is incompatible with layer conv1d_1: expected ndim=3, found ndim=2

我对使用Keras还是很陌生,请为我详细说明每一步。非常感谢你!

0 个答案:

没有答案