Tensorflow import_meta_graph returns a "tensor does not exist" error

I am trying to import a saved neural network into Tensorflow. I saved it after a workout with:

saver = tf.train.Saver()
saver.save(sess, filename)

and in the script I use for output, I restore it with

sess = tf.Session()
saver = tf.train.import_meta_graph(filename.meta)
saver.restore(sess, tf.train.latest_checkpoint('./'))

But during the line, import_meta_graphI get this error:

KeyError: "The name" dropout1 / cond / dropout / Shape / Switch: 1 "refers to a tensor that does not exist. The operation" dropout1 / cond / dropout / Shape / Switch "does not exist in the graph."

I looked at the names of tensors and operations in the original laptop in which I trained the model, and the names mentioned in the error message really exist. Moreover, I used the same code to save and import other models, and it works. The only difference is that I trained them on an AWS machine with an older version of tensor flow, while I trained them on my computer.

+4
source share

Source: https://habr.com/ru/post/1668944/


All Articles