卷积尺寸

时间:2019-04-26 10:18:08

标签: keras model nlp embedding

我对此代码有疑问:

sequence_input = Input(shape=(MAX_SEQUENCE_LENGTH,), dtype='int32')
embedded_sequences = embedding_layer(sequence_input)
x = Conv1D(128, 5, activation='relu')(embedded_sequences)
x = MaxPooling1D(5)(x)
x = Conv1D(128, 5, activation='relu')(x)
x = MaxPooling1D(5)(x)
x = Conv1D(128, 5, activation='relu')(x)
x = MaxPooling1D(35)(x)  # global max pooling
x = Flatten()(x)
x = Dense(128, activation='relu')(x)
preds = Dense(len(labels_index), activation='softmax')(x)

错误是:

ValueError: Negative dimension size caused by subtracting 5 from 3 for 'conv1d_6/convolution/Conv2D' (op: 'Conv2D') with input shapes: [?,1,3,128], [1,5,128,128].

我的文档是包含125个文本的列表,这些文本包含1000个或更多或更少的单词。

0 个答案:

没有答案