Let me try to explain with an example.
Suppose we set resolution=64 and init_resolution=8. Before entering the while loop I have  the last output as (128,8,8). These are the further steps inside the while loop:

Upsampling to (128,16,16),crt_res=8
Conv layer with input channels=128 and output channels=256
Upsampling to (256,32,32),crt_resolution=16
Conv layer with input channels=256 and output channels=256
Upsampling to (256,64,64),
Conv layer with input channels=256 and output channels=128

Now, the Conv layers in points 2. and 4. are being added by the same line of code. How can this be done in Pytorch without defining the resolution beforehand.