Skip to content

Commit 2b33675

Browse files
committed
Set default backend to TF on windows.
1 parent 0f0d8be commit 2b33675

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

keras/backend/__init__.py

+6-8
Original file line numberDiff line numberDiff line change
@@ -23,22 +23,20 @@
2323
if not os.path.exists(_keras_dir):
2424
os.makedirs(_keras_dir)
2525

26-
# Set theano as default backend for Windows users since tensorflow is not available for Windows yet.
27-
if os.name == 'nt':
28-
_BACKEND = 'theano'
29-
else:
30-
_BACKEND = 'tensorflow'
26+
# Default backend: TensorFlow.
27+
_BACKEND = 'tensorflow'
3128

3229
_config_path = os.path.expanduser(os.path.join(_keras_dir, 'keras.json'))
3330
if os.path.exists(_config_path):
3431
_config = json.load(open(_config_path))
3532
_floatx = _config.get('floatx', floatx())
3633
assert _floatx in {'float16', 'float32', 'float64'}
3734
_epsilon = _config.get('epsilon', epsilon())
38-
assert type(_epsilon) == float
35+
assert isinstance(_epsilon, float)
3936
_backend = _config.get('backend', _BACKEND)
4037
assert _backend in {'theano', 'tensorflow'}
41-
_image_dim_ordering = _config.get('image_dim_ordering', image_dim_ordering())
38+
_image_dim_ordering = _config.get('image_dim_ordering',
39+
image_dim_ordering())
4240
assert _image_dim_ordering in {'tf', 'th'}
4341

4442
set_floatx(_floatx)
@@ -68,7 +66,7 @@
6866
sys.stderr.write('Using TensorFlow backend.\n')
6967
from .tensorflow_backend import *
7068
else:
71-
raise Exception('Unknown backend: ' + str(_BACKEND))
69+
raise ValueError('Unknown backend: ' + str(_BACKEND))
7270

7371

7472
def backend():

0 commit comments

Comments
 (0)