[TensorRT] Resize input layer and get Dimension of the output layer?

Hello,

another question,
is it possible to resize the input layer of an engine at the start of the inference?
And is it possible to get the output dimensions of the same engine?

For example i want to run alexnet, only the first layers until the first maxpooling. Now it would support any image size, but because i load the engine from a trained caffe model i takes the image size from the .prototxt.
For clearity: I want to change the input size when i have the optimized engine not before (otherwise training would take ages.)

I can change the input size in the prototxt, but it would be way easier in code. If it would be poosible to change the input size “dynamically”, is there a way to extract the output size?

I could be:

engine.get_binding_dimensions()

but in python this gives me c pointer (?) which i can’t dereference…

Thanks!

I am not very confident, but I think you could try:
Assume that you know your input and output layers:

int input_index = engine.getBindingIndex("name_input");
int output_index = engine.getBindingIndex("name_output");

Then, if you use

dim = engine.getBindingDimension(input_index)

, it should gives you a Dim object, which you can use dim[0], dim [1] or dim[2] (based on the number of dimemsion of your input).