[FIXED] What is the difference between MaxPool and MaxPooling layers in Keras?


I just started working with and noticed that there are two layers with very similar names for max-pooling: MaxPool and MaxPooling. I was surprised that I couldn’t find the difference between these two on Google; so I am wondering what the difference is between the two if any.


They are the same… You can test it on your own

import numpy as np
import tensorflow as tf
from tensorflow.keras.layers import *

# create dummy data
X = np.random.uniform(0,1, (32,5,3)).astype(np.float32)

pool1 = MaxPool1D()(X)
pool2 = MaxPooling1D()(X)

tf.reduce_all(pool1 == pool2) # True

I used 1D max-pooling but the same is valid for all the pooling operations (2D, 3D, avg, global pooling)

Answered By – Marco Cerliani

Answer Checked By – David Marino (Easybugfix Volunteer)

Leave a Reply

(*) Required, Your email will not be published