TensorFlow 0.12 Model Files

后端 未结 2 1602
自闭症患者
自闭症患者 2021-01-20 01:18

I train a model and save it using:

saver = tf.train.Saver()
saver.save(session, \'./my_model_name\')

Besides the checkpoint file,

2条回答
  •  天命终不由人
    2021-01-20 01:53

    I'm currently struggling with this myself, I've found it's not very straightforward to do currently. The two most commonly cited tutorials on the subject are: https://medium.com/jim-fleming/loading-a-tensorflow-graph-with-the-c-api-4caaff88463f#.goxwm1e5j and https://medium.com/@hamedmp/exporting-trained-tensorflow-models-to-c-the-right-way-cf24b609d183#.g1gak956i

    The equivalent of

    new_saver = tf.train.import_meta_graph('./my_model_name.meta')
    new_saver.restore(session, './my_model_name')
    

    Is just

    Status load_graph_status = LoadGraph(graph_path, &session);
    

    Assuming you've "frozen the graph" (Used a script with combines the graph file with the checkpoint values). Also, see the discussion here: Tensorflow Different ways to Export and Run graph in C++

提交回复
热议问题