Week 1 - Assignment 2 - Exercise - Unnecessary padding


can it be that the “padding 'SAME'” prompt/hint for the max pool layers is somewhat misleading?
I understand that if one sets padding='same' the subsequent test checks out, and if one does not set padding='same' the test fails.

However, I think setting padding='same' has no effect if stride is not 1. At least the output shape of the first max pool layer in both cases (with and without padding set) is (8,8,8), so the shape definitely is not the same as the input.

Also, despite the test not checking out, training the model on the training data leads to exactly the same outcome in either case.

Or am I missing something? But I feel like the way the exercise is set up now is at best confusing, probably even wrong and only accidentally does no harm as the argument seems to be ignored by the API.

The definition of “same” padding only gives the same output size when stride = 1. If stride > 1, then the size will be smaller even with “same” padding. Here’s a thread which discusses that in more detail. Actually this thread is much more detailed and shows actual results, although it only covers Conv2D, not pooling. In the Conv2D case it is definitely not true that “same” padding is a NOP when stride > 1. It’s just that it does not give the same output size in that case. We need to run the same experiment with pooling, though.