Convolutional layer output calculation

Hello, I have a question about the output of Pooling layer of the convolutional networks, as I remember the simplified equation was ((n+2p-f) / s) + 1 with n is input dimension, p is padding, f is size of filter(s) and s is stride so a 150x150 image goes through a 2x2 pooling layer should have: (150+2*0-2)/1 + 1 = 149 output, is it correct?

You’re right.

Do remember that when strides isn’t specified for the MaxPooling2D layer, strides = pool size (2 by default.)

>>> import tensorflow as tf
>>> layer = tf.keras.layers.MaxPooling2D(strides=1) # default pool size is (2, 2)
>>> batch_data = tf.random.uniform(shape=(1, 150, 150, 3))
>>> layer(batch_data).shape
TensorShape([1, 149, 149, 3])

So in the first-week quiz, the pooling layer size (2,2) means it is a (2, 2) pooling layer with stride of 2, is that right?

That is correct

Hello, I still believe the question is ambiguous unless I am missing something.

Shouldn’t the question then ask to assume that we’re using TensorFlow? Even though this course is based on TensorFlow, “Pooling” by itself does not indicate to assume the default behavior of TensorFlow. At the very least a quiz description should be added that says “This quiz is about TensorFlow API functionality” :thinking:

When in doubt, it’s safe to assume that staff are asking you a tensorflow related question since that’s the only API that matters for this specialization.