Reshaping with an unknown dimension (-1)

Hi all,

When parsing my TensorFlow model, I get the following error:

UFFParser: Parser error: Reshape: -1 dimension specified more than 1 time

This is a face detection model which includes two submodels running on top of ResNet. One submodel is for classification, and the other is for regression. After I construct each submodel (there is a reshape function included in each of them where one of the dimensions is not specified, i.e., reshape(-1, x)), I apply them to multiple feature proposal networks, hence, creating a pyramid network (if you are familiar with retinanet, it is similar). When trying to parse this pyramid network in Tensorrt, trt complains that the unknown dimension -1 has been specified more than once, which I assume happens because of the multiple pyramid levels, each with its own unknown dimension.

Anybody has ever had a similar experience? What’s a possible workaround?


Hello, 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

Linux distro: Ubuntu 16.04
GPU: GTX 1080 Ti
Nvidia Driver Version: 384.130
CUDA: 9.0
CUDNN: 7.1
Python: I am using C++ for building the TensorRT engine and doing inference on a frozen model built with python3.5. I am using a custom plugin as well.
Tensorflow version: 1.6
TensorRT version: 4.0

Hello kamzhik

Can you provide a pb and the script you used to build the TRT engine? It’d help us debug.

NVIDIA Enterprise Support

@kamzhik hi ,have you solved the problem? I am facing the same problem. looking forward to your reply