Question about the layer configurations in Lab2

def classifier(inputs):
    x = tf.keras.layers.GlobalAveragePooling2D()(inputs)
    x = tf.keras.layers.Flatten()(x)
    x = tf.keras.layers.Dense(1024, activation="relu")(x)
    x = tf.keras.layers.Dense(512, activation="relu")(x)
    x = tf.keras.layers.Dense(10, activation="softmax", name="classification")(x)
    return x

Regarding the first two layers in the classifier, I’m confused why it would be additionally necessary to add Flatten() atop GlobalAveragePooling2D, which already converts the 3D output to 1D without consideration of the batch dimension, when you check the model summary.

They do not perform the same operation on the input. Have a look on the function at Keras.

Thanks for your info.