Convert tensorflow frozen model (pb file) to TRT Inference model (uff)

Linux distro and version - Ubuntu 18.04
GPU type - 128-core Maxwell
nvidia driver version - 32.1
CUDA version - 10.0
Python version - 3.6
Tensorflow version - 1.13
TensorRT version - 5 (but using tensorrt.legacy)
Device - Jetson Nano

I am facing a issue while converting a pb file to uff format to do inference. I have pasted the error message below.

Traceback (most recent call last):
File “”, line 18, in
uff_model = uff.from_tensorflow_frozen_model(model_path, [“resid_gated_unet/decoder/final_conv/outgoing1x1/bias_add”], preprocessor = None, quiet = True, return_graph_info = True)
File “/usr/lib/python3.6/dist-packages/uff/converters/tensorflow/”, line 187, in from_tensorflow_frozen_model
return from_tensorflow(graphdef, output_nodes, preprocessor, **kwargs)
File “/usr/lib/python3.6/dist-packages/uff/converters/tensorflow/”, line 157, in from_tensorflow
File “/usr/lib/python3.6/dist-packages/uff/converters/tensorflow/”, line 94, in convert_tf2uff_graph
uff_graph, input_replacements, debug_mode=debug_mode)
File “/usr/lib/python3.6/dist-packages/uff/converters/tensorflow/”, line 79, in convert_tf2uff_node
op, name, tf_node, inputs, uff_graph, tf_nodes=tf_nodes, debug_mode=debug_mode)
File “/usr/lib/python3.6/dist-packages/uff/converters/tensorflow/”, line 47, in convert_layer
return cls.registry_[op](name, tf_node, inputs, uff_graph, **kwargs)
File “/usr/lib/python3.6/dist-packages/uff/converters/tensorflow/”, line 283, in convert_depthwise_conv2d_native
return _conv2d_helper(name, tf_node, inputs, uff_graph, func=“depthwise”, **kwargs)
File “/usr/lib/python3.6/dist-packages/uff/converters/tensorflow/”, line 308, in _conv2d_helper
number_groups = int(wt.attr[‘value’].tensor.tensor_shape.dim[2].size)
File “/usr/local/lib/python3.6/dist-packages/google/protobuf/internal/”, line 208, in getitem
return self._values[key]
IndexError: list index out of range

I found that this error is caused due to a change in input shape order. I tried to create a plugin node for input and pass the InputOrder function parameter but that does not work.

I followed example from this link: