An error occured when run from_tensorflow.py in Compile Tensorflow Models tutorial

  File "from_tensorflow.py", line 100, in <module>
    graph_def.ParseFromString(f.read())
google.protobuf.message.DecodeError: Error parsing message

happened when I run from_tensorflow.py in Compile Tensorflow Models tutorial. my enviroment: tensorflow: version 2.0.0

python: 3.6

OS:Ubuntu18.04

TVM 0.7

source code:


with tf_compat_v1.gfile.GFile(model_path, "rb") as f:
    graph_def = tf_compat_v1.GraphDef()
    graph_def.ParseFromString(f.read())
    graph = tf.import_graph_def(graph_def, name="")
    # Call the utility to import the graph definition into default graph.
    graph_def = tf_testing.ProcessGraphDefParam(graph_def)
    # Add shapes to the graph.
    with tf_compat_v1.Session() as sess:
        graph_def = tf_testing.AddShapesToGraphDef(sess, "softmax")

how to solve it?

By my experience, maybe your model.pb file is not complete. e.g., the right model.pb should be 40M bytes while yours is only 6M bytes. so you should check model.pb first.