Skip to content

Instantly share code, notes, and snippets.

@benwu232
Created February 8, 2017 07:11
Show Gist options
  • Save benwu232/73d95d930c5e1f1555acc91de2a27bf8 to your computer and use it in GitHub Desktop.
Save benwu232/73d95d930c5e1f1555acc91de2a27bf8 to your computer and use it in GitHub Desktop.
Show how to restore model, parameters, inputs and outputs
import tensorflow as tf
tf.GraphKeys.USEFUL = 'useful'
saver = tf.train.import_meta_graph("./model_ex1.meta")
sess = tf.Session()
saver.restore(sess, "./model_ex1")
var_list = tf.get_collection(tf.GraphKeys.USEFUL)
v1 = var_list[0]
v2 = var_list[1]
v4 = var_list[2]
#result = sess.run(v4, feed_dict={"v1:0": 12.0, "v2:0": 3.3})
result = sess.run(v4, feed_dict={v1:12.0, v2:3.3})
print(result)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment