Skip to content

Commit aa28910

Browse files
committed
Prepare 2.2.5 release.
1 parent 4385de6 commit aa28910

File tree

5 files changed

+23
-11
lines changed

5 files changed

+23
-11
lines changed

keras/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@
2323
from .models import Model
2424
from .models import Sequential
2525

26-
__version__ = '2.2.4'
26+
__version__ = '2.2.5'

keras/backend/tensorflow_backend.py

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,18 @@
6161
_LOCAL_DEVICES = None
6262

6363

64+
def _get_default_graph():
65+
try:
66+
return tf.get_default_graph()
67+
except AttributeError:
68+
raise RuntimeError(
69+
'It looks like you are trying to use '
70+
'a version of multi-backend Keras that '
71+
'does not support TensorFlow 2.0. We recommend '
72+
'using `tf.keras`, or alternatively, '
73+
'downgrading to TensorFlow 1.14.')
74+
75+
6476
def get_uid(prefix=''):
6577
"""Get the uid for the default graph.
6678
@@ -71,7 +83,7 @@ def get_uid(prefix=''):
7183
A unique identifier for the graph.
7284
"""
7385
global _GRAPH_UID_DICTS
74-
graph = tf.get_default_graph()
86+
graph = _get_default_graph()
7587
if graph not in _GRAPH_UID_DICTS:
7688
_GRAPH_UID_DICTS[graph] = defaultdict(int)
7789
_GRAPH_UID_DICTS[graph][prefix] += 1
@@ -101,7 +113,7 @@ def clear_session():
101113
shape=(),
102114
name='keras_learning_phase')
103115
_GRAPH_LEARNING_PHASES = {}
104-
_GRAPH_LEARNING_PHASES[tf.get_default_graph()] = phase
116+
_GRAPH_LEARNING_PHASES[_get_default_graph()] = phase
105117

106118

107119
def manual_variable_initialization(value):
@@ -130,7 +142,7 @@ def learning_phase():
130142
# Returns
131143
Learning phase (scalar integer tensor or Python integer).
132144
"""
133-
graph = tf.get_default_graph()
145+
graph = _get_default_graph()
134146
if graph not in _GRAPH_LEARNING_PHASES:
135147
with tf.name_scope(''):
136148
phase = tf.placeholder_with_default(
@@ -154,7 +166,7 @@ def set_learning_phase(value):
154166
if value not in {0, 1}:
155167
raise ValueError('Expected learning phase to be '
156168
'0 or 1.')
157-
_GRAPH_LEARNING_PHASES[tf.get_default_graph()] = value
169+
_GRAPH_LEARNING_PHASES[_get_default_graph()] = value
158170

159171

160172
def get_session():
@@ -247,7 +259,7 @@ def _get_current_tf_device():
247259
the device (`CPU` or `GPU`). If the scope is not explicitly set, it will
248260
return `None`.
249261
"""
250-
g = tf.get_default_graph()
262+
g = _get_default_graph()
251263
op = _TfDeviceCaptureOp()
252264
g._apply_device_functions(op)
253265
return op.device

setup.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
'''
2525

2626
setup(name='Keras',
27-
version='2.2.4',
27+
version='2.2.5',
2828
description='Deep Learning for humans',
2929
long_description=long_description,
3030
author='Francois Chollet',
@@ -37,8 +37,8 @@
3737
'six>=1.9.0',
3838
'pyyaml',
3939
'h5py',
40-
'keras_applications>=1.0.6',
41-
'keras_preprocessing>=1.0.5'],
40+
'keras_applications>=1.0.8',
41+
'keras_preprocessing>=1.1.0'],
4242
extras_require={
4343
'visualize': ['pydot>=1.2.4'],
4444
'tests': ['pytest',

tests/docs/test_documentation.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ def handle_class(name, member):
4242

4343

4444
def handle_function(name, member):
45+
if name.startswith('_'):
46+
return
4547
if is_accepted(name, member) or member_too_small(member):
4648
# We don't need to check this one.
4749
return

tests/keras/engine/test_topology.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -480,8 +480,6 @@ def test_recursion():
480480
j_tf = tf.placeholder(dtype=K.floatx())
481481
k_tf = tf.placeholder(dtype=K.floatx())
482482
m_tf, n_tf = tf_model([j_tf, k_tf])
483-
assert m_tf.get_shape().as_list() == [None, 64]
484-
assert n_tf.get_shape().as_list() == [None, 5]
485483

486484
# test merge
487485
layers.concatenate([j_tf, k_tf], axis=1)

0 commit comments

Comments
 (0)