so if you input is x, which is a 4-dimensional tensor of size [batch_size, 2048, 14, 14] where 2048 is the number of channels (or feature maps), then you can apply the AvgPooling as follows:
out = torch.nn.functional.avg_pool2d(x, kernel_size=14)

this will result in output of size [batch_size, 2048, 1, 1], but you need to reshape it to get [batch_size, 2048]:
out = out.reshape(-1, 2048)

This is called Global Average Pooling.
A full example is given below:
>>> x = torch.randn(32, 2048, 14, 14)
>>> x.shape
torch.Size([32, 2048, 14, 14])
>>> out = F.avg_pool2d(x, kernel_size=14)
>>> out.shape
torch.Size([32, 2048, 1, 1])