由于tensorflow的版本是Ubuntu下 2.0.0,所以会和以前版本有所区别:
Error: module 'tensorflow' has no attribute 'GraphDef'
原来语句:
graph_def = tf.GraphDef.FromString(file_handle.read())
修改后语句:
graph_def = tf.compat.v1.GraphDef.FromString(file_handle.read())
Error: module 'tensorflow' has no attribute 'Session'
原来语句:
self.sess = tf.Session(graph=self.graph)
修改后语句:
self.sess = tf.compat.v1.Session(graph=self.graph)