Tensorflow服务训练模型保存saved_model

问题描述 投票:0回答:1

我发现tf.saved_model文档不清晰,没有任何有价值的资源如何阅读其他会话中训练模型?

tensorflow
1个回答
0
投票

这是一样简单:

# Clear the default graph if any
tf.reset_default_graph()
# Create a saver/loader object
loader = tf.train.Saver()
# Build the same graph architecture (Easiest to do with a class)
model = YourModel()
# Create a session
with tf.Session() as sess:
    # Initialize the variables in the graph
    sess.run(tf.global_variables_initializer())
    # Restore the learned weights from a saved checkpoint
    loader.restore(sess, path_to_checkpoint_dir)
© www.soinside.com 2019 - 2024. All rights reserved.