[TRT7 Python API] How to get the derived layers of the base ILayer from a network?


INetworkDefinition.get_layer returns an ILayer, instead of the actual derived subclass of the ILayer.
If I need to insect the attributes of a certain layer, such as the weights and bias of a convolution layer, how should I do?

For example, if the first layer of my network is a convolution layer. Ideally, I could call:
to get the kernel weights of this convolution layer I wanted.
However, network[0] returns an ILayer object, with the type of LayerType.CONVOLUTION. It seems I can only get the methods and attributes of the base class of this IConvolutionLayer. How could I get the actual object of the IConvolutionLayer?


TensorRT Version: 7.0
GPU Type: 1080 Ti
Nvidia Driver Version: 418.56
CUDA Version: 10.0
CUDNN Version: 7.6
Operating System + Version: Ubuntu 18.04
Python Version (if applicable): 3.6.9

Hi @helloxinyao.wang,
I am afraid but you can’t get the derived class information, as this the expected behavior.

Thanks for your reply!