首页 > 解决方案 > 未知?塑造 keras 深度学习

问题描述

我正在尝试使用 Keras 实现深度学习模型。然而,我遇到了未知形状实现的问题。我正在寻找类似的错误,但没有找到。

这是我的代码。

Xhome = dataset[:,32:62]

Xaway = dataset[:,62:92]

Ywin = dataset[:,2:32]

Yscorehome = dataset[:,0]

Yscoreaway = dataset[:,1]

home = Input(shape=(2431,30))

print(home)

Tensor("input_6:0", shape=(?, 2431, 30), dtype=float32)

图表

问我是否需要更多信息才能理解。

标签: pythoninputkerasdeep-learningshapes

解决方案


The unknown shape (? or None) is not an error - it means that this dimension is variable instead of fixed sized.

The first dimension in a Keras model is always the batch size and therefore gets the shape None. This allows you to use variable batch sizes. When you define your input shape in a Keras layer the batch size dimension is ignored and you only define the shape of each sample. In your case, the input shape (2431,30) means that each sample has this shape. If you want 2431 to be the batch size, you should instead use (30,) as input shape.


推荐阅读