with tf.Graph().as_default() as g1:
    x = tf.placeholder('float')
w = tf.Variable(1.0, name='w')
y = x * w
saver = tf.train.Saver()
with tf.Session(graph=g1) as sess:
    w.initializer.run()
saver.save(sess, 'my_model1.ckpt')
with tf.Graph().as_default() as g2:
    x = tf.Variable(2.0, name='v')
w = tf.Variable(0.0, name='w')
z = x + w
restorer = tf.train.Saver([w])
with tf.Session(graph=g2) as sess:
    x.initializer.run()
restorer.restore(sess, 'my_model1.ckpt')
print(z.eval())
Tensorflow: как заменить узел в графе вычислений?