Skip to content

Instantly share code, notes, and snippets.

@xiaohan2012
Created September 26, 2017 19:08
Show Gist options
  • Save xiaohan2012/5456951471c6e7fd19fc796809ab303a to your computer and use it in GitHub Desktop.
Save xiaohan2012/5456951471c6e7fd19fc796809ab303a to your computer and use it in GitHub Desktop.
tensorflow: get tensor value from checkpoint
import tensorflow as tf
checkpoint_file = 'runs/deepwalk/checkpoints/model-25000'
sess = tf.InteractiveSession()
saver = tf.train.import_meta_graph("{}.meta".format(checkpoint_file))
saver.restore(sess, checkpoint_file)
embedding_table = sess.graph.get_operation_by_name('embedding/table')
val = embedding_table.outputs[0].eval()
print(val)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment