python - keras 序列模型中的多个输出

标签 python tensorflow keras

正如我正在阅读 Keras Code for Sequential models我看到它只允许对 Sequential 中的任何定义层进行单个输出。模型。我知道如何使用功能 API( Model 类)来做到这一点。

但是,我不明白为什么 Sequential模型仅限于具有单个输出的层。强制执行此类约束是否存在设计限制?

最佳答案

实际上不。在设计更小、更直接的神经网络时,序列模型可以让事情变得更简单。如前所述 here ,它们对大多数问题都有用。

The Sequential API allows you to create models layer-by-layer for most problems. It is limited in that it does not allow you to create models that share layers or have multiple inputs or outputs.



但如果您需要更复杂的设计,具有多个输入/输出以及共享层的模型,您可以使用 函数式API 以实现您的目标。

关于python - keras 序列模型中的多个输出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53679643/

相关文章:

python - 在 Keras (tensorflow) 中合并多个模型

python - TFLearn 导入错误

python - 如何从 Keras 中的 ImageDataGenerator 格式化 X 和 Y 数据?

python - Python 中的系数矩阵 - 组元素

python - 如何进一步优化计算所有交叉和?

tensorflow - 图像评估中的张量板边界框限制

python - 类型错误 : Unrecognized keyword arguments: {'show_accuracy' : True} #yelp challenge dataset

python - 在组合网络的子网上使用两种损失

python - cv2、scipy.misc 和 skimage 之间的区别

python - Numpy 数据类型 : data type not understood