Global max pooling?

(Fangzou Liao) #1

Hi, I am looking for the global max pooling layer.

Because in my case, the input shape is uncertain and I want to use global max pooling to make their shape consistent. But I do not find this feature in pytorch?

(Francisco Massa) #2

You can use the functional interface of max pooling for that. In you forward function:

import torch.nn.functional as F
output = F.max_pool2d(input, kernel_size=input.size()[2:])