x = torch.rand(2, 3, 128, 128)
F.adaptive_avg_pool2d(x, output_size=1).flatten(start_dim=1)

x = torch.rand(2, 3, 128, 128)
x.mean(dim=(2, 3))

Is there any difference between two above?
I think both are same and the second one is more simple and understandable.
But I assume there is any reason why most people are using first one.