如何使用Keras切换后端(从TensorFlow到Theano) [英] How to switch Backend with Keras (from TensorFlow to Theano)
问题描述
我试图用Keras切换后端(从TensorFlow到Theano),但是没有管理. 我按照此处所述的温度进行操作,但是它不起作用.我在keras的目录中创建了一个keras.json(因为它不存在),但是当我从Python导入它时,它没有任何改变.
I tried to switch Backend with Keras (from TensorFlow to Theano) but did not manage. I followed the temps described here but it doesn't work. I created a keras.json in the keras' directory (as it did not exist) but it doesn't change anything when I import it from Python.
推荐答案
在您的主目录中创建一个.keras
(请注意前面的.
)文件夹并将keras.json
文件放在此处.
Create a .keras
(note the .
in front) folder in you home directory and put the keras.json
file there.
例如,如果您使用的是类似UNIX的系统(MacOS X,Linux,* BSD),请使用/home/DaniPaniz/.keras/keras.json
(或简称为~/.keras/keras.json
).在Windows上,您要创建文件夹%USERPROFILE%/.keras
并将JSON文件放在其中.
For example, /home/DaniPaniz/.keras/keras.json
(or ~/.keras/keras.json
in short) if you are on a UNIX like system (MacOS X, Linux, *BSD). On Windows you want to create the folder %USERPROFILE%/.keras
and put the JSON file there.
或者,您也可以设置环境变量KERAS_BACKEND
:
Alternatively, you can also set the environment variable KERAS_BACKEND
:
KERAS_BACKEND=theano python mymodel.py
这篇关于如何使用Keras切换后端(从TensorFlow到Theano)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!