Skip to content
Home » In function importPad: Assertion failed: inputs.at(1).is_weights()

In function importPad: Assertion failed: inputs.at(1).is_weights()

ERROR: builtin_op_importers.cpp: In function importPad: Assertion failed: inputs.at(1).is_weights()

This error occurs mainly because of non-constant padding. The tensorrt supports only constant padding so try below methods:

  1. TensorRT should be updated to allow non-const pads (as per ONNX spec)
  2. If TensorRT is the conversion target, update tf2onnx to convert non-const pads to a composition of other operators with the same behaviour (Const of shape, concat). This could lead to performance concerns.
  3. Select fixed image dims as input and reconvert the model using those dims. I haven’t tried it, but the calculations should be able to be reduced to constants.
  4. Also try to solve the problem using ONNX-Simplifier.

Also Read:

ValueError: get tensor value: stack_Concat__28 must be Const

Tags: