python - Keras - 将函数式 API 模型连接在一起

标签 python neural-network theano keras conv-neural-network

我正在尝试将 2 个功能性 API 模型连接在一起。这是 2 个模型的总结:

第一个“输入”模型(它作为一个单一的模型工作得很好):

model1

应该连接到第一个模型的第二个模型:

model2

我正在尝试像这样将它们连接在一起:

model = Model(input=generator.input, output=[discriminator.output[0], discriminator.output[1]])

但是我得到这个错误:

Graph disconnected: cannot obtain value for tensor discriminator_input at layer "discriminator_input". The following previous layers were accessed without issue: []

我试着像这样用它们制作模型:

Model(input=[generator.input, discriminator.input], output=[discriminator.output[0], discriminator.output[1]])

但这段代码只是产生了第二个模型(而不是两个一起),或者至少这是我在获得模型摘要并绘制其结构后的想法。

我们可以在 Keras 中执行此操作(连接函数式 API 模型)还是有其他方法? 谢谢

最佳答案

我认为模型应该在您尝试传递张量时接受图层? 您应该尝试关注讨论,因为我也有关于时间分布层的问题。 https://github.com/fchollet/keras/issues/4178https://github.com/fchollet/keras/issues/2609

关于python - Keras - 将函数式 API 模型连接在一起,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40277327/

相关文章:

python - 有没有办法始终在 plotly scattermapbox 中显示所有标记,而不管手动缩放?

image-processing - Caffe 支持 16 位图像吗?如果没有,如何实现支持?

python-2.7 - Tensor对数组可变

python - Django NOT NULL 约束失败 : shop_product. user_id

python - 从 pdf 中删除一些图像和文本对象

c# - C# 中的神经网络 - NaN 和无穷大

machine-learning - Logistic 函数 加法或减法

python - 不适用于 Keras 框架的示例

python - pandas.DataFrame.loc ,在新列中标记数据

c# - EmguCV 中的多层感知器