Does Maxpool2d have any learnable parameter?

I am wondering if maxpool2d in pytorch as any learnable parameter? and if so what is that?
I saw people use self.pool1 = nn.MaxPool2d(2, 2) , self.pool2 = nn.MaxPool2d(2, 2), etc in their models. So i assume there should be some learnable parameters.

The reason that im asking is that im trying to build my own maxpool and wanna make sure im doing it right.

Max pooling does not have any learnable parameters.
You can check if with:

pool = nn.MaxPool2d(2)
print(list(pool.parameters()))
> []

The initialization of these layers is probably just for convenience, e.g. if you want easily change the pooling operation without changing your forward method.

1 Like