You can use this solution :

Define ModuleA which expects fixed size input and doesn’t have any control flow
Define ModuleB which which handles the input resize and then call ModuleA

ModuleA can be exported into onnx format, and you should care about the resize manually.