Average and adaptive pooling can be combined and these names do not refer to the same layer.
In the linked example, an nn.AdaptiveAvgPool2d 4 layer is used. The docs give you an example of how to use it, but let me know, if you get stuck.