onnx-tensorrt icon indicating copy to clipboard operation
onnx-tensorrt copied to clipboard

Assertion failed: axesInput.allValuesKnown() && "Axes input for unsqueeze operation should be a constant tensor."

Open joan126 opened this issue 3 years ago • 2 comments

when using onnx2trt to convert onnx model to trt engine, an error occurs :

Assertion failed: axesInput.allValuesKnown() && "Axes input for unsqueeze operation should be a constant tensor."

testing environment

tensorflow models converted to onnx model. 18.04.1-Ubuntu onnx-tensorrt 7.2.1 TensorRT-7.2.1.6

It seems that unseqeeze does not supported . In my tensorflow codes, tf.expand_dims(tensor, axis=1) is used.

so how to solve this issue?

joan126 avatar Feb 07 '22 10:02 joan126

tf.expand_dims(tensor, axis=1) suggests that the unsqueeze axis should be a constant 1.

What TF2ONNX version are you using? Are you able to share the model?

kevinch-nv avatar Feb 07 '22 16:02 kevinch-nv

tf.expand_dims(tensor, axis=1) suggests that the unsqueeze axis should be a constant 1.

What TF2ONNX version are you using? Are you able to share the model? tf.expand_dims(tensor, axis=1) the axis is indeed constant 1 and related dependencies are below : tf2onnx 1.9.3 onnx 1.10.2 pypi_0 pypi onnx-simplifier 0.2.28 pypi_0 pypi onnxoptimizer 0.2.6 pypi_0 pypi onnxruntime 1.10.0 pypi_0 pypi

joan126 avatar Feb 08 '22 02:02 joan126