0

I have the same question as TensorFlow saver - Saving an ordinary Python variable. I need to save and restore a python variable in tensorflow. But I can't find a way to do it. I need to restore my python variable, and then restore and use it to compute something else in the restored model, like:

accuracy = ('accuracy:0', feed_dict = {'data:0':my_data, '????:0':my_python_variable, 'label:0':my_labels}) 

'my_python_variable' is an input to compute the accuracy of the original training model. When I look at all the nodes, and also all the saved variables in the restored model, I can't find any node associated with this ordinary python variable. Any idea?

nightrain
  • 306
  • 1
  • 3
  • 13
  • 1
    have you thought about `pickle` ? – Moritz Jan 19 '18 at 20:55
  • Can you please provide an example how to use a restored variable from 'pickle' in 'feed_dict' in a restored tensorflow model? – nightrain Jan 19 '18 at 22:10
  • Maybe you can create a constant with [`tf.constant`](https://www.tensorflow.org/versions/r1.5/api_docs/python/tf/constant)? – kww Jan 19 '18 at 23:56
  • I do not use tensorflow. I just wanted to know whether you have considered this as an option and if there are any reasons why it should not work. The link you posted explains it all. Try it out and post the errors you get. – Moritz Jan 20 '18 at 10:09
  • So, I figured this out. When you want to call a function in the restored model, you need to check the input parameters in the tensorbord. In my case, tensorbord says there is no need for that python variable to call the function 'accuracy', so there is no need to save that python variable in my tensorflow trained model. – nightrain Mar 05 '18 at 17:16

0 Answers0