Last active
December 2, 2018 10:10
-
-
Save hadifar/57bfcee17ed9630e2cda027f5f6a9820 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import tensorflow as tf | |
v1 = tf.Variable(80., name="v1") | |
v2 = tf.Variable(10., name="v2") | |
a = tf.add(v1, v2) | |
saver0 = tf.train.Saver(var_list=[v1, v2]) | |
saver1 = tf.train.Saver(var_list={'myVar1': v1, 'myVar2': v2}) | |
saver2 = tf.train.Saver(var_list={'myVar1': v1}) | |
saver3 = tf.train.Saver(var_list=tf.trainable_variables()) | |
saver = tf.train.Saver() | |
with tf.Session() as sess: | |
sess.run(tf.global_variables_initializer()) | |
saver.save(sess, './saver_test/myVar') | |
saver.restore(sess, './saver_test/myVar') | |
print(sess.run(v1)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment