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

**URL:** <https://forums.developer.nvidia.com/t/tensorrt-resize-input-layer-and-get-dimension-of-the-output-layer/58247>\
**Category:** TensorRT\
**Created:** [February 15, 2018, 9:48am UTC](https://forums.developer.nvidia.com/t/tensorrt-resize-input-layer-and-get-dimension-of-the-output-layer/58247 "2018-02-15T09:48:21Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![KalvinMiller](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@KalvinMiller](https://forums.developer.nvidia.com/u/KalvinMiller)\
**Post date:** [February 15, 2018, 9:48am UTC](https://forums.developer.nvidia.com/t/tensorrt-resize-input-layer-and-get-dimension-of-the-output-layer/58247/1 "2018-02-15T09:48:21Z")

</div>

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:

```auto
engine.get_binding_dimensions()

```

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

Thanks!

---

<div class="post-metadata">

**Author:** ![dht7166](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@dht7166](https://forums.developer.nvidia.com/u/dht7166)\
**Post date:** [July 20, 2018, 12:29pm UTC](https://forums.developer.nvidia.com/t/tensorrt-resize-input-layer-and-get-dimension-of-the-output-layer/58247/2 "2018-07-20T12:29:20Z")

</div>

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

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

```

Then, if you use

```auto
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).
