0

I have variables that change size over the course of the program, and variables that should get added into the middle of the Graph, but when I run the program, those variables remain unchanged.

I found this question which tells me it's not possible to change variables after the Graph has been created, and suggests a method of creating a session with a new graph. When I tried that, I got issues with having uninitialized Variables. I tried saving the variables I needed and then restoring them in the new Session, but it still claimed they were uninitialized.

How can I add Variables to a Session while keeping their previous values? Or, better if possible, how can I change the size of Variables in a Graph, or force the Graph to restructure without reinitializing the Variables?

Community
  • 1
  • 1
Beez
  • 391
  • 5
  • 6
  • 16
  • You could save values of TensorFlow variables to python variables, and then use those Python values to initialize your variables when building new graph – Yaroslav Bulatov Jan 26 '16 at 18:50
  • I can't access the TensorFlow values, that's been one of the big things making progress slow from the start. The Variables I need are weight and bias matrices, but I can't just grab the values. – Beez Jan 26 '16 at 19:13
  • do "(x,y) = sess.run([varx, vary]); .... make new session/graph....varx=tf.Variable(x); sess.run(tf.initialize_all_variables())" – Yaroslav Bulatov Jan 26 '16 at 19:18

0 Answers0