How to Invert AvgPool2d?
Is it possible to invert an avgPool2d operation in PyTorch, like maxunpool2d for a maxpool2d operation, and if so, how could that be done?

I've already checked the documentation, and there isn't an option to return the indices, like in the maxpool2d operation, so I assume the unpooling won't be possible in a similar way.

EDIT:
I found a document by Intel which describes how the unpooling works. After checking the math regarding the avgpool2d function the unpooling seems to be pretty straight forward, basically mirroring every input element onto multiple output elements, and apply padding in order to get a correct output size.

I think you are looking for ConvTransposed2d, aka deconvolution: This function allows you to "upsample" the pooled layer.
Using fixed weights you can replicate the averged pooled values. You can also train this layer hopefully getting something better.
