Determine output size on the fly with TensorRT

Hi,

Let’s say I have a caffe model that takes as input an image of a maximum size but that sometimes I want to give it a smaller input image. There is no problem so far, I get my results but I don’t know their exact dimensions.

Is there a way to determine the output shape knowing the input image size (C++ API)?

Example: Maximum input size is (1x1x2048x2048) for which the output size is (1x6x249x249), my image has a size of (1x1x1569x1569). The output is supposed to have a size of (1x6x187x187), but how can I know that with the C++ API?

Thanks.