美文网首页
Build a website

Build a website

作者: MrGiovanni | 来源:发表于2017-12-31 15:33 被阅读39次
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

相关文章

网友评论

      本文标题:Build a website

      本文链接:https://www.haomeiwen.com/subject/xrfagxtx.html