I would claim it depends a bit on the expected input shapes.
I.e. in case you are using input shapes as powers of 2, reduce the spatial size by 2, and increase it later by the same factor in the transposed conv layers, I don’t think you would be running into a lot of issues.
However, for arbitrary input shapes, the upsampling layers could cause ambiguous output shapes, so that you could then pass the desired output shape as an argument to the forward method of the transposed conv layers.
To do so I would remove the nn.Sequential container and use the layers manually in the forward of the main model, which would allow you to pass the output_size argument.