I know that the default backend for Keras switched from Theano to TensorFlow, but with the Dev version of Theano I can train on GPUs with OpenCL (I have an AMD card).
However, when I import Keras, it only uses TensorFlow support even after changing the values in the Keras configuration file :
~ $ cat $HOME/.keras/keras.json
{"epsilon": 1e-07, "floatx": "float32", "backend": "theano"}
~ $ python -c 'import keras'
Using TensorFlow backend.
~ $ KERAS_BACKEND=theano python -c 'import keras'
Using Theano backend.
Mapped name None to device opencl0:2: AMD Radeon R9 M370X Compute Engine
In addition, I know that Keras reads the configuration file after import, because if I fill in some invalid value for "backend"
, I get an error message:
~ $ cat $HOME/.keras/keras.json
{"epsilon": 1e-07, "floatx": "float32", "backend": "foobar"}
~ $ python -c 'import keras'
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/Users/antalek/anaconda/envs/ENVPy3/lib/python3.5/site-packages/keras/__init__.py", line 3, in <module>
from . import activations
File "/Users/antalek/anaconda/envs/ENVPy3/lib/python3.5/site-packages/keras/activations.py", line 3, in <module>
from . import backend as K
File "/Users/antalek/anaconda/envs/ENVPy3/lib/python3.5/site-packages/keras/backend/__init__.py", line 34, in <module>
assert _backend in {'theano', 'tensorflow'}
AssertionError
System Information:
- Mac OSX 10.11.6
- Anaconda Python v 3.5
- Keras v 2.0.2
I would like Keras to use Theano as the default backend. Does anyone know how to install it as such?
EDIT:
@Marcin Możejko:
~ $ which python
/Users/<my name>/anaconda/envs/ENVPy3/bin/python
conda, Keras.