How can I print shape of each layer?

I am using caffe parser and my library version is TensorRT 4.0. I want to print input/output shape of each layer with C++ API, like

layer1_input -> (N1, C1, W1, H1)
layer1_output -> (N2, C2, W2, H2)

How can I do that?


Iterate over the layers in INetworkDefinition using getNbLayers() / getLayer(), then call

  • getNbInputs () Get the number of inputs of a layer
  • getNbOutputs () Get the number of outputs of a layer.