|
23 | 23 | if not os.path.exists(_keras_dir):
|
24 | 24 | os.makedirs(_keras_dir)
|
25 | 25 |
|
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' |
31 | 28 |
|
32 | 29 | _config_path = os.path.expanduser(os.path.join(_keras_dir, 'keras.json'))
|
33 | 30 | if os.path.exists(_config_path):
|
34 | 31 | _config = json.load(open(_config_path))
|
35 | 32 | _floatx = _config.get('floatx', floatx())
|
36 | 33 | assert _floatx in {'float16', 'float32', 'float64'}
|
37 | 34 | _epsilon = _config.get('epsilon', epsilon())
|
38 |
| - assert type(_epsilon) == float |
| 35 | + assert isinstance(_epsilon, float) |
39 | 36 | _backend = _config.get('backend', _BACKEND)
|
40 | 37 | 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()) |
42 | 40 | assert _image_dim_ordering in {'tf', 'th'}
|
43 | 41 |
|
44 | 42 | set_floatx(_floatx)
|
|
68 | 66 | sys.stderr.write('Using TensorFlow backend.\n')
|
69 | 67 | from .tensorflow_backend import *
|
70 | 68 | else:
|
71 |
| - raise Exception('Unknown backend: ' + str(_BACKEND)) |
| 69 | + raise ValueError('Unknown backend: ' + str(_BACKEND)) |
72 | 70 |
|
73 | 71 |
|
74 | 72 | def backend():
|
|
0 commit comments