What I would like to do is run several pre-prepared Tensorflow networks at the same time. Since the names of some variables within each network may be the same, a common solution is to use the namespace when creating the network. However, the problem is that I trained these models and saved prepared variables inside several control point files. After I use the namespace when creating a network, I cannot load variables from checkpoint files.
For example, I trained AlexNet, and I would like to compare two sets of variables, one set from era 10 (saved in the epoch_10.ckpt file), and the other set from era 50 (saved to the epoch_50.ckpt file). Since the two are exactly the same network, the variable names inside are the same. I can create two networks using
with tf.name_scope("net1"):
net1 = CreateAlexNet()
with tf.name_scope("net2"):
net2 = CreateAlexNet()
However, I cannot load trained variables from .ckpt files, because when I trained this network, I did not use the namespace. Despite the fact that I can set the namespace to "net1" when I train the network, this prevents me from loading variables for net2.
I tried:
with tf.name_scope("net1"):
mySaver.restore(sess, 'epoch_10.ckpt')
with tf.name_scope("net2"):
mySaver.restore(sess, 'epoch_50.ckpt')
This does not work.
What is the best way to solve this problem?
denru source
share