简体   繁体   English

在theano和tensorflow之间加载keras后端的不一致

[英]Inconsistent loading of keras backend between theano and tensorflow

My keras.json has backend specified to be tensorflow and if I open Spyder and Jupyter IDE then tensorflow is used as a backend. 我的keras.json后端指定为tensorflow ,如果我打开Spyder和Jupyter IDE,那么tensorflow用作后端。

Strangely if I open python or ipython shell within my WinPython installation, the backend defaults into theano . 奇怪的是,如果我在WinPython安装中打开pythonipython shell,后端默认为theano Has anyone seen this behaviour before and if so what was the solution? 有没有人见过这种行为,如果有的话,解决方案是什么?

I have tried playing with environment variables to no effect. 我试过玩环境变量没有效果。

I have exactly same issue. 我有完全相同的问题。 Some how after I installed shell kernel Ipython/Jupyter is pointing properly to tensor flow 我安装shell内核之后的一些内容Ipython / Jupyter正确指向张量流

import os

os.environ['KERAS_BACKEND']='tensorflow'
import keras
keras.backend.backend()

Looks like existing notebooks still say Theano. 看起来现有的笔记本仍然说Theano。 But If I create new one and enter the following then I get proper result as tensorflow import os 但是如果我创建新的并输入以下内容,那么我会得到正确的结果,因为tensorflow导入os

os.environ['KERAS_BACKEND']='tensorflow'
import keras
keras.backend.backend()

Using TensorFlow backend. 使用TensorFlow后端。 Out[1]: 'tensorflow' In [ ]: Out [1]:'tensorflow'在[]中:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM