python - 未知?塑造 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)
问我是否需要更多信息才能理解。
解决方案
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.
推荐阅读
- visual-studio-code - 我可以在 VS Code 中使用带有 Emmet 的 jsx/tsx 的 `styleName` 而不是 `className`
- powerbi - Power bi:只要你有某个变量的值,就计算一个函数
- javascript - 异步发布父子对象和关系(递归?)
- amazon-ses - Amazon SES 电子邮件身份验证需要错误
- css - 下边距及其结果
- ruby - 通过别名运行 ruby 时获取真正的工作目录
- javascript - 将数组的每个单独项作为纯字符串返回
- neovim - 在 neovim 的特定窗口中禁用语法高亮
- python - 两次调用函数,但在第二次,函数返回的第一个列表在 python 中作为参数
- c - 使用 sscanf 解析和动态分配大小不一致的子字符串