ONNX export with constant upscaling dimensions

I am trying to export an FPN model with a constant input size, meaning that the feature maps have constant sizes and so are the target dimensions of the upscaled maps. To determine the upscaling target dimensions, I do use the shape of the “parent” feature map, but I don’t want the ONNX model to include that tensor-shape query part in its graph.

Whenever I use opset_version>9 when calling onnx.export, it always keeps track of the query of the tensor’s shape, which I want to avoid. I want to have constants for upscaling.

I tried to make the tracer lose track of the shape query using many hacks, but none of them worked. Only thing that worked was using opset_verison=9. Things I tried as hacks included converting to string and then back to int, converting to float and adding some constant < 1 and then flooring it back to int, using a for loop on a range near the dimension and saving the iterator value… but the tracer is really really sticky, non of my hacks worked, it still includes the shape query in the ONNX graph…

Is there a way to make it use constant target dimensions for upscaling without using opset version 9?