TensorRT4 reshape volume mismatch

I tried to use reshape operation in my network, which want to reshape an image placeholder from shape (None, 256, 256, 3) to (-1, 128, 2, 128,2,3) and then finally reshape to (-1, 128, 128, 12)

here is the script:
def Dmux1(x, name=‘dmux’):
with tf.variable_scope(name) as scope:
x_reshaped = tf.reshape(x, [-1, 128, 2, 128, 2, 3])
x_transposed = tf.transpose(x_reshaped, [0, 1, 3, 2, 4, 5])
y = tf.reshape(x_transposed, [-1, 128, 128, 12])
return y

and a volume mismatch error raised
AssertionError: UFF parsing failed on line 255 in statement assert(parser.parse(stream, network, model_datatype))
[TensorRT] INFO: UFFParser: parsing generator/dmux1/dmux/Reshape/shape
[TensorRT] INFO: UFFParser: parsing generator/dmux1/dmux/Reshape
[TensorRT] ERROR: UFFParser: Parser error: generator/dmux1/dmux/Reshape: Reshape: Volume mismatch
[TensorRT] ERROR: Failed to parse UFF model stream

and I found that there is a similar question about reshape problem, https://devtalk.nvidia.com/default/topic/1036882/jetson-tx2/volume-mismatch-error-at-tensorrt-engine/post/5269001/#5269001

and NVIDIA Official gave a answer is that for tensorRT3 the reshape operation is only used for weights,

but I have a question about that, How fully Connection layers works when using TensorRT?


To help us debug, can you share a minimal repro package containing your network and source code that demonstrates the error you are seeing? Also, can you provide details on the platforms you are using?

Linux distro and version
GPU type
nvidia driver version
CUDA version
CUDNN version
Python version [if using python]
Tensorflow version
TensorRT version

hello, I have fixed this error. I also have tested tf.reshape func in the official examples https://docs.nvidia.com/deeplearning/sdk/tensorrt-api/python_api/workflows/tf_to_tensorrt.html.
and found that tensorrt will raise volume mismatch error when the tensor dimension exceeds 4.

for example, reshape a (None, 256,256,3) tensor to (-1, 128,2,128,2,3) will cause an error,
but reshape this tensor to (-1, 128,128,12) is ok. Please check this
Linux ubuntu 16.04
GPU tesla p100
cuda 9.0
cudnn 7.1.3
python 2.7


This will be fixed in the next TensorRT release. Unfortunately, I can’t discuss release schedule here, but please stay tuned for our future announcements.

you can update tensorrt to and rebuild space_to_deepth by reshape and transpose(I guess you encounter the same error with me)

Has this been resolved. I have and it seems to be still an issue. Thanks.