Skip to content

Instantly share code, notes, and snippets.

@williamjshipman
Created June 23, 2019 18:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save williamjshipman/16d11fbaf14e4eb905ad83289102bad0 to your computer and use it in GitHub Desktop.
Save williamjshipman/16d11fbaf14e4eb905ad83289102bad0 to your computer and use it in GitHub Desktop.
def save_weights(sess):
saver = tf.train.Saver()
saver.save(sess, './data/tf_io.ckpt')
def load_weights(sess, in_name, out_name):
tf.train.import_meta_graph('./data/tf_io.ckpt.meta')
saver = tf.train.Saver()
saver.restore(sess, './data/tf_io.ckpt')
X = tf.get_default_graph().get_tensor_by_name(in_name)
y = tf.get_default_graph().get_tensor_by_name(out_name)
return X, y
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment