unsupported number of graph 0 error when using TensorRT C++ interface

Hi all,

I am using TensorRT on Windows - version 5.0 GA. I have a tensorflow model which I have exported to an UFF file as shown by the code below. Note that since the python packages UFF and graph_surgeon are not available in the windows distribution, I have used the Linux tarball to get them and install them.

Get current session

tf_session = K.backend.get_session()

# For now assume that the output of the last layer of the model is the output
output_name  = model.layers[-1].output.name.split(':')[0]
output_names = [output_name]

# Freeze graph - this is deprecated
graph_def = tf.graph_util.convert_variables_to_constants(tf_session, tf_session.graph_def, output_names)

# Remove training nodes
graph_def = tf.graph_util.remove_training_nodes(graph_def)

# Convert graph into UFF format so that it can be loaded by TensorRT
graph_nodes = [n for n in graph_def.node]
names = [node.name for node in graph_nodes]
uff.from_tensorflow(graphdef=graph_def, text=True, list_nodes=True, output_filename='test1.uff')

In my C++ code, I have the following:
IBuilder* builder = createInferBuilder(gLogger);
INetworkDefinition* network = builder->createNetwork();
IUffParser* parser = nvuffparser::createUffParser();

// Hard coded, but can be easily parameterised
parser->registerInput("conv2d_1_input", DimsCHW(28, 28, 1), UffInputOrder::kNHWC);

parser->parse(std::string("test11.uff", *network, nvinfer1::DataType::kFLOAT);

The parse() call above give the error: unsupported number of graph 0 error.

Can someone shed light on what is going on? Could it be because of version mismatch of TensorFlow/TensorRT?

I am using TensorRT 5.0 GA, CUDA v9.0, cuDNN v7, tensorflow 1.2.1 python v3.6