cd /Users/zongwei/Documents/Website/cellweb
python manage.py runserver
Tensor Tensor("main_output/Sigmoid:0", shape=(?, 224, 224, 1), dtype=float32) is not an element of this graph.
I had this problem when doing inference in a different thread than where I loaded my model. Here's how I fixed the problem:
Right after loading or constructing your model, save the TensorFlow graph:
graph = tf.get_default_graph()
In the other thread (or perhaps in an asynchronous event handler), do:
global graph
with graph.as_default():
(... do inference here ...)
I learned about this from https://www.tensorflow.org/versions/r0.11/api_docs/python/framework.html#get_default_graph
网友评论