Guillaume Niay
Guillaume Niay

Reputation: 71

Unknown ? shape keras Deep learning

I’m trying to implement a deep learning model with 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)

diagram

Ask me if you need more information to understand.

Upvotes: 2

Views: 1819

Answers (1)

Anna Krogager
Anna Krogager

Reputation: 3588

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.

Upvotes: 3

Related Questions