[E] [TRT] concat: all concat input tensors must have the same dimensions except on the concatenation...

We have a concat layer in our Tensorflow model. When converting it to TRT, we got the following error:
[E] [TRT] concat: all concat input tensors must have the same dimensions except on the concatenation axis

Here is our code:
inputs = tf.concat([cancat_mv2, prev], axis=3)

Could you please help take a look? It seems that TRT uses the incorrect axis to concat. Our input date format is NHWC so we use “3” as the axis.

Thanks

Hi,

The root cause is that UFF parser doesn’t support concatenating constant currently.
It’s recommended to use TF’s constfold optimizer as a workaround.

Attached is a sample for constant folding for your reference.
fold_constants.zip (995 Bytes)

The constant folding couldn’t solve our problem. We have to concat multiple tensors into a big tensor in real time because we got those tensors calculated every frame. They are not constant values. Please let me know if you guys have a workaround. thanks

Hi,

Sorry that I miss the concatenate axis you used.

https://docs.nvidia.com/deeplearning/sdk/tensorrt-developer-guide/index.html#concatenation-layer
Please noticed that only the concatenate along the channel axis is supported by TensorRT currently.
Since your input is NHWC, the axis=3 is beyond our support matrix.

Thanks.

We have tried axis=1 with NCHW, but we got exactly the same error. :(