Skip to content

Commit

Permalink
Prepare 2.2.5 release.
Browse files Browse the repository at this point in the history
  • Loading branch information
fchollet committed Aug 22, 2019
1 parent 4385de6 commit aa28910
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 11 deletions.
2 changes: 1 addition & 1 deletion keras/__init__.py
Expand Up @@ -23,4 +23,4 @@
from .models import Model
from .models import Sequential

__version__ = '2.2.4'
__version__ = '2.2.5'
22 changes: 17 additions & 5 deletions keras/backend/tensorflow_backend.py
Expand Up @@ -61,6 +61,18 @@
_LOCAL_DEVICES = None


def _get_default_graph():
try:
return tf.get_default_graph()
except AttributeError:
raise RuntimeError(
'It looks like you are trying to use '
'a version of multi-backend Keras that '
'does not support TensorFlow 2.0. We recommend '
'using `tf.keras`, or alternatively, '
'downgrading to TensorFlow 1.14.')


def get_uid(prefix=''):
"""Get the uid for the default graph.
Expand All @@ -71,7 +83,7 @@ def get_uid(prefix=''):
A unique identifier for the graph.
"""
global _GRAPH_UID_DICTS
graph = tf.get_default_graph()
graph = _get_default_graph()
if graph not in _GRAPH_UID_DICTS:
_GRAPH_UID_DICTS[graph] = defaultdict(int)
_GRAPH_UID_DICTS[graph][prefix] += 1
Expand Down Expand Up @@ -101,7 +113,7 @@ def clear_session():
shape=(),
name='keras_learning_phase')
_GRAPH_LEARNING_PHASES = {}
_GRAPH_LEARNING_PHASES[tf.get_default_graph()] = phase
_GRAPH_LEARNING_PHASES[_get_default_graph()] = phase


def manual_variable_initialization(value):
Expand Down Expand Up @@ -130,7 +142,7 @@ def learning_phase():
# Returns
Learning phase (scalar integer tensor or Python integer).
"""
graph = tf.get_default_graph()
graph = _get_default_graph()
if graph not in _GRAPH_LEARNING_PHASES:
with tf.name_scope(''):
phase = tf.placeholder_with_default(
Expand All @@ -154,7 +166,7 @@ def set_learning_phase(value):
if value not in {0, 1}:
raise ValueError('Expected learning phase to be '
'0 or 1.')
_GRAPH_LEARNING_PHASES[tf.get_default_graph()] = value
_GRAPH_LEARNING_PHASES[_get_default_graph()] = value


def get_session():
Expand Down Expand Up @@ -247,7 +259,7 @@ def _get_current_tf_device():
the device (`CPU` or `GPU`). If the scope is not explicitly set, it will
return `None`.
"""
g = tf.get_default_graph()
g = _get_default_graph()
op = _TfDeviceCaptureOp()
g._apply_device_functions(op)
return op.device
Expand Down
6 changes: 3 additions & 3 deletions setup.py
Expand Up @@ -24,7 +24,7 @@
'''

setup(name='Keras',
version='2.2.4',
version='2.2.5',
description='Deep Learning for humans',
long_description=long_description,
author='Francois Chollet',
Expand All @@ -37,8 +37,8 @@
'six>=1.9.0',
'pyyaml',
'h5py',
'keras_applications>=1.0.6',
'keras_preprocessing>=1.0.5'],
'keras_applications>=1.0.8',
'keras_preprocessing>=1.1.0'],
extras_require={
'visualize': ['pydot>=1.2.4'],
'tests': ['pytest',
Expand Down
2 changes: 2 additions & 0 deletions tests/docs/test_documentation.py
Expand Up @@ -42,6 +42,8 @@ def handle_class(name, member):


def handle_function(name, member):
if name.startswith('_'):
return
if is_accepted(name, member) or member_too_small(member):
# We don't need to check this one.
return
Expand Down
2 changes: 0 additions & 2 deletions tests/keras/engine/test_topology.py
Expand Up @@ -480,8 +480,6 @@ def test_recursion():
j_tf = tf.placeholder(dtype=K.floatx())
k_tf = tf.placeholder(dtype=K.floatx())
m_tf, n_tf = tf_model([j_tf, k_tf])
assert m_tf.get_shape().as_list() == [None, 64]
assert n_tf.get_shape().as_list() == [None, 5]

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

0 comments on commit aa28910

Please sign in to comment.