Keras模型建筑

2024-09-28 04:25:08 发布

您现在位置:Python中文网/ 问答频道 /正文

我创建了Keras模型。然后我使用了一个函数来绘制模型的架构图。它创建了png文件,如下所示。在

创建模型的代码:

model = Sequential()
model.add(LSTM(50, input_shape=(train_X.shape[1], train_X.shape[2])))
model.add(Dense(1, activation='linear'))
model.compile(loss='mae', optimizer='adam', metrics=[self.coeff_determination])

创建建筑png图像的行:

^{pr2}$

这是我得到的图像:

enter image description here

问题是图顶部的大数字意味着什么。在


Tags: 文件函数代码模型图像addmodelpng
1条回答
网友
1楼 · 发布于 2024-09-28 04:25:08

最初的回答是here。检查此链接:https://github.com/keras-team/keras/issues/10638

在keras/发动机中/顺序.py-注释掉以下代码:

@property
def layers(self):
    # Historically, `sequential.layers` only returns layers that were added
    # via `add`, and omits the auto-generated `InputLayer`
    # that comes at the bottom of the stack.
    if self._layers and isinstance(self._layers[0], InputLayer):
        return self._layers[1:]
    return self._layers

相关问题 更多 >

    热门问题