Suppose I have three batches of feature maps, each of size $180 \times 100 \times 100$. I want to concatenate all these feature maps channel-wise, and then resize them into a single feature map. The batch size is equal to 10.
Consider the following code in PyTorch
import torch from torch import nn x1 = torch.randn(10, 180, 100, 100) x2 = torch.randn(10, 180, 100, 100) x3 = torch.randn(10, 180, 100, 100) pool1 = nn.AvgPool3d(kernel_size = (361, 1, 1), stride= 1) pool2 = nn.AvgPool3d(kernel_size = 1, stride= (3, 1, 1)) final_1_x = pool1(torch.cat((x1, x2, x3), 1)) final_2_x = pool2(torch.cat((x1, x2, x3), 1)) print(final_1_x.shape) print(final_2_x.shape)
and its output is
torch.Size([10, 180, 100, 100]) torch.Size([10, 180, 100, 100])
You can observe that both types of polling I did are able to give a feature map of the desired size. But the first one takes a large amount of time with unsatisfactory results and the second one ignores many values in the input feature maps. I don't know whether it is okay to ignore or not.
I want to know the recommended way to perform polling in order to get the desired size of feature maps. Is there any such recommended way to perform pooling?