hello everyone
i am trying to restore a saved variable in tensorflow. seems like it is very very complicated.
in a python file, alexnet.py, I define the variable
conv5W = tf.Variable(net_data["conv5"][0],name='conv5w')
then, i finetune the model and i see that some of its values are changed. i save the finetuned model by typing:
saver = tf.train.Saver()
saver.save(sess,"modelname.ckpt")
after that, i open a new ipython console and run:
from alexnet import *
sess=tf.InteractiveSession()
new_saver = tf.train.import_meta_graph("modelname.ckpt.meta")
new_saver.restore(sess, "modelname.ckpt")
after that, when i try to retrieve the values of the variables with:
conv5W.eval(session=sess)
it yields:
FailedPreconditionError: Attempting to use uninitialized value conv5w
[[Node: conv5w/_98 = _Send[T=DT_FLOAT, client_terminated=false, recv_device="/job:localhost/replica:0/task:0/cpu:0", send_device="/job:localhost/replica:0/task:0/gpu:0", send_device_incarnation=1, tensor_name="edge_4_conv5w", _device="/job:localhost/replica:0/task:0/gpu:0"](conv5w)]]
[[Node: conv5w/_99 = _Recv[_start_time=0, client_terminated=false, recv_device="/job:localhost/replica:0/task:0/cpu:0", send_device="/job:localhost/replica:0/task:0/gpu:0", send_device_incarnation=1, tensor_name="edge_4_conv5w", tensor_type=DT_FLOAT, _device="/job:localhost/replica:0/task:0/cpu:0"]()]]
on the other hand, if I initialize variable with:
init = tf.initialize_all_variables()
this time it yields the initial values in net_data["conv5"][0], not the finetuned ones