Is it possible to find the inverse of AdaptiveAvgPool2d?

For example,

x = torch.rand(1, 3, 7, 7)  
m = torch.nn.AdaptiveAvgPool2d(output_size=1)
y = m(x)     #   y.shape = (1, 3, 1, 1)

Is it possible to obtain x via y?

You won’t be able to calculate the input values of the mean calculation.
However, if you are more concerned about the shapes (not the exact values) you could use e.g. nn.ConvTranspose2d.

1 Like