Skip to content

Instantly share code, notes, and snippets.

@wut0n9
Created February 13, 2019 23:30
Show Gist options
  • Save wut0n9/67f936aeb62ddbfc8ea2937a36269466 to your computer and use it in GitHub Desktop.
Save wut0n9/67f936aeb62ddbfc8ea2937a36269466 to your computer and use it in GitHub Desktop.
模型持久化及加载 #加载图模型
checkpoint_file = 'topic_dnn/tf/model-10'
session_conf = tf.ConfigProto(
allow_soft_placement=True,
log_device_placement=True
)
with tf.Session(config=session_conf) as sess:
saver = tf.train.import_meta_graph('{}.meta'.format(checkpoint_file))
saver.restore(sess, checkpoint_file)
input_x = tf.get_default_graph().get_operation_by_name('input_x').outputs[0]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment