Keras布局在Tensorflow中是如何工作的

How does Keras layout works in Tensorflow

我正在测试 Tensorflow,但我无法弄清楚模型的结构。比如官方文档中有如下说明:

A Sequential model is appropriate for a plain stack of layers where each layer has exactly one input tensor and one output tensor.

...

A Sequential model is not appropriate when:

 - Your model has multiple inputs or multiple outputs
 - Any of your layers has multiple inputs or multiple outputs
 - You need to do layer sharing
 - You want non-linear topology (e.g. a residual connection, a multi-branch model)

这是否意味着该模型只接受 1 个值类型的数据作为 Input/Output 或仅接受 1 个值作为 Input/Output?

我想做的是使用两个十六进制值来预测第三个十六进制值,为此,我将数据集按位结构化,例如:

hex0[0], hex0[1],.... hex0[n], hex1[0], hex1[1], ... hex1[n], result[0], result[1]... result[n]
0       ,1      ,..., 1      , 1      , 9      , ...,1      , 1        , 1       ,... , 0  

keras.Sequential 模型适用于此类问题吗?

这意味着它只接受一种类型的数据(所有值都是数字值或所有值都是分类值),因为在顺序模型中,所有输入值都按顺序通过所有层。

我更喜欢 keras.io 中的文档 https://keras.io/api/models/sequential/#sequential-class

在您的情况下,所有输入数据都是同一类型,因此您可以使用顺序模型。

输入为:[hex0[0],hex1[0]

输出结果[0]

输入和输出数组的形状非常重要。