Week 1 - Assignment 2

I am trying to do the part of the functional API, and my code goes as this:

 # mentor edit: code removed

However, I am getting the following error:

InvalidArgumentError: Shape must be rank 4 but is rank 5 for '{{node max_pooling2d_28/MaxPool}} = MaxPool[T=DT_FLOAT, data_format="NHWC", ksize=[1, 8, 8, 1], padding="SAME", strides=[1, 8, 8, 1]](max_pooling2d_28/MaxPool/input)' with input shapes: [1,?,64,64,8].

If I connect the Conv2D layer directly to the MaxPool it works fine, but adding the ReLU produces that error. According to the documentation, its output should have the same shape as its input, so I do not understand why it is changing.

1 Like

Why do you have a comma at the end of the β€œA1 = …” line?

1 Like

Good question, thanks for pointing that out. I don’t know why it was there, but that was the issue. Thanks again!

1 Like

Auto completion. I ran into the same issue with the comma at the end of the A1= line. it almost drove me crazy. Removing the comma solves the issue.