简体   繁体   English

未知? 形状 keras 深度学习

[英]Unknown ? shape keras Deep learning

I'm trying to implement a deep learning model with Keras.我正在尝试使用 Keras 实现深度学习模型。 Yet I have a problem with an unknown shape implementation.但是我有一个未知形状实现的问题。 I was looking for a similar error but didn't find it.我正在寻找类似的错误,但没有找到。

Here is my code.这是我的代码。

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)

图表

Ask me if you need more information to understand.问我是否需要更多信息才能理解。

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 . Keras 模型中的第一个维度始终是批量大小,因此形状为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.当您在 Keras 层中定义输入形状时,批次大小维度将被忽略,您只需定义每个样本的形状。 In your case, the input shape (2431,30) means that each sample has this shape.在您的情况下,输入形状(2431,30)表示每个样本都具有此形状。 If you want 2431 to be the batch size, you should instead use (30,) as input shape.如果您希望 2431 作为批量大小,则应改为使用(30,)作为输入形状。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM