Accessing weights before building the engine


Is it possible to access/display the weights of a specific layer after having defined the network and loaded the relevant weights (the model is not parsed from Caffe or ONNX but hardcoded) and this before building the engine ( e.g.ICudaEngine* engine = builder->buildEngineWithConfig(*network, *config);.)
The best I could get out of the documentation is how to get the layers name and type. e.g.
load_types();//makes a list of all possible layertypes
int n_layers = network->getNbLayers();
for (int n = 0; n < n_layers; n++) {
auto layer = network->getLayer(n);
auto name = layer->getName();
auto type = int(layer->getType());
//auto weights_role = int(layer->WeightsRole);
std::cout << n << ") has name " << name << " of type " << layer_types[type] << std::endl;


TensorRT Version: TensorRT7.0.0
GPU Type: 2080TI
Nvidia Driver Version: 445.87
CUDA Version: 10.2
CUDNN Version:
Operating System + Version:
Python Version (if applicable):
TensorFlow Version (if applicable):
PyTorch Version (if applicable):
Baremetal or Container (if container which image + tag):

Relevant Files

Please attach or include links to any models, data, files, or scripts necessary to reproduce your issue. (Github repo, Google Drive, Dropbox, etc.)

Steps To Reproduce

Please include:

  • Exact steps/commands to build your repro
  • Exact steps/commands to run your repro
  • Full traceback of errors encountered

Hi @oooj4c,
I dont think this is possible,
As we expect the user to know what the weights they provide are.