dynamic_shape UFF parser error "at least 4 dimensions are required"

I run my C++ code with tensorrt6.0.1, it build engine from UFF file. It worked without dynamic_shape and out error when use dynamic_shape:

[W] [TRT] Calling isShapeTensor before the entire network is constructed may result in an inaccurate result.
[W] [TRT] Calling isShapeTensor before the entire network is constructed may result in an inaccurate result.
[E] [TRT] model/lambda/add: at least 4 dimensions are required for input
[E] [TRT] model/lambda/truediv: elementwise inputs must have same dimensions or follow broadcast rules (input dimensions were [-1,-1,1] and [])
[E] [TRT] UffParser: Parser error: model/forward_1_conv2D/Conv2D: Order size is not matching the number dimensions of TensorRT
[E] [TRT] Network must have at least one output
Segmentation fault (core dumped)

I used explicit batch flag and register input,output:

network = builder->createNetworkV2(1U << static_cast<int>(NetworkDefinitionCreationFlag::kEXPLICIT_BATCH));
dims = Dims3(-1,-1,1)
parser->registerInput(input_names[i].c_str(), dims, order);
parser->registerOutput(output_names[i].c_str());

I installed:

apt-get -y install libnvinfer6=6.0.1-1+cuda10.0 libnvinfer-dev=6.0.1-1+cuda10.0
apt-get -y install libnvparsers6=6.0.1-1+cuda10.0 libnvparsers-dev=6.0.1-1+cuda10.0
apt-get -y install libnvinfer-plugin6=6.0.1-1+cuda10.0 libnvinfer-plugin-dev=6.0.1-1+cuda10.0

How to fix?

Hi,
I think dynamic shape is currently not supported by UFF parser.
ONNX parser in TRT 7.0 has fully support dynamic shapes.
You can try tf2onnx + ONNX parser as an alternative.
https://github.com/onnx/tensorflow-onnx

Thanks