TensorFlow saving into/loading a graph from a file

前端 未结 2 1978
长情又很酷
长情又很酷 2020-11-29 14:52

From what I\'ve gathered so far, there are several different ways of dumping a TensorFlow graph into a file and then loading it into another program, but I haven\'t been abl

2条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-11-29 15:43

    You can try the following code:

    with tf.gfile.FastGFile('model/frozen_inference_graph.pb', "rb") as f:
        graph_def = tf.GraphDef()
        graph_def.ParseFromString(f.read())
        g_in = tf.import_graph_def(graph_def, name="")
    sess = tf.Session(graph=g_in)
    

提交回复
热议问题