Tensorflow是否在PyCharm中加载两次? [英] Is Tensorflow loading twice in PyCharm?
问题描述
我正在使用flask作为运行带有张量流后端的keras的Web服务器.每次重新启动它时,它都会显示如下:
I'm using flask as the web server running keras with tensor flow backend. Every time I restart it, it shows up like this:
这是否意味着Tensorflow加载两次?还是因为我在PyCharm中运行它并且调试器处于活动状态-如何禁用它?在IDLE上运行时,下面的3行不会出现. Tensorflow加载需要相当长的时间,因此,如果我只能加载一次,那就太好了.
Does this mean that Tensorflow is loading twice? Or is it because I'm running it in PyCharm and the debugger is active - how can I disable it? The 3 lines below don't come up when running on IDLE. Tensorflow takes quite a while to load, so it would be great if I can only have it load once.
感谢您的任何评论和建议.
Thank you for any comment and suggestions.
推荐答案
我遇到了相同的错误.就我而言,这是因为predict
是在与调用load_model
的线程不同的线程中调用的.将它们移到相同的线程上,问题就消失了.
I ran into the same error. In my case it was because predict
was called in a different thread than the one in which load_model
was called. Moved them to the same thread the the problem was gone.
这篇关于Tensorflow是否在PyCharm中加载两次?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!