【发布时间】:2019-12-16 09:37:58
【问题描述】:
我有一个包含两个文本字段的数据集,在标记化之后我创建了两个顺序模型,我正在尝试合并或合并,但是在合并时我遇到了错误。
我已经构建了两个顺序模型,我正在尝试在不使用 Keras 功能 API 的情况下合并它们。
# define the model
model1 = Sequential()
model1.add(Embedding(vocabulary_size_1, embedding_size, input_length=MAXLEN))
model1.add(Flatten())
model1.add(Dense(op_units, activation='softmax'))
# define the model
model2 = Sequential()
model2.add(Embedding(vocabulary_size_2, embedding_size, input_length=MAXLEN))
model2.add(Flatten())
model2.add(Dense(op_units, activation='softmax'))
merged = concatenate(axis=1)
merged_model=merged([model1.output, model2.ouput])
TypeError Traceback (most recent call last)
<ipython-input-76-79cf08fec6fc> in <module>
----> 1 merged = concatenate(axis=1)
2 merged_model=merged([model1.output, model2.ouput])
TypeError: concatenate() missing 1 required positional argument: 'inputs'
我期待一种不使用 Keras 功能 API 的方法
【问题讨论】:
标签: keras deep-learning nlp artificial-intelligence