[8] Assertion failed: inputs.at(1).is_weights() && "The input pads is required to be an initializer."


ModelImporter.cpp:726: ERROR: builtin_op_importers.cpp:2985 In function importPad:
[8] Assertion failed: inputs.at(1).is_weights() && “The input pads is required to be an initializer.”


TensorRT Version:
GPU Type: 2080Ti
Nvidia Driver Version: 495
CUDA Version: 11.3
CUDNN Version:
Operating System + Version: 18.04
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

above is the Pad in my onnx model, please help me to solve it.

Hi ,
We recommend you to check the supported features from the below link.

You can refer below link for all the supported operators list.
For unsupported operators, you need to create a custom plugin to support the operation


I checked it before and know that tensorrt doesnot support dynamic padding size, however, what I want to do is to solve the problem, for example, using graphsurgeon to modifiy the Padding node’s inputs pads to be a constant, do you know is that solution viable and how to do that?


You can try following. If you still face issue, we recommend you to please share issue reproducible onnx model to try from our end for better debugging.

Thank you.