How to remove the adaptive average pool layer from vgg19?

Double post from here with a warning, that this approach might break your model if the forward method isn’t fixed afterwards.