It’s a bit hard to debug your code, but I think the easiest way currently would be to specify your size for torch.nn.functional.interpolate. Currently you are using scale_factor=2. Alternatively you could pass the desired size and use size=size in the Unet_up_block.