Get intermediate layer output

I am using the Python API and I would like to get the output of an hidden layer after the execution of an engine. Is this possible?

Hi @mfoglio,

We can set the layer as a network output and bind a buffer to it to collect the output.

Thank you.

The engine is built in C++ and run in Python. Can I do that while loading the engine in Python or should I do that when building it in C++? You can refer to this repository: tensorrtx/yolov5 at master · wang-xinyu/tensorrtx · GitHub

Hi @mfoglio,

We cannot do while loading. We need to set the layer as a network output and regenerate the engine.

Thank you.