Skip to content
This repository has been archived by the owner on Nov 3, 2022. It is now read-only.

Commit

Permalink
Cleanup deprecated utils.
Browse files Browse the repository at this point in the history
  • Loading branch information
fchollet committed May 30, 2019
1 parent dda4997 commit 2c9b0f5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 50 deletions.
45 changes: 0 additions & 45 deletions keras_applications/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,51 +10,6 @@
_KERAS_UTILS = None


def set_keras_submodules(backend=None,
layers=None,
models=None,
utils=None,
engine=None):
# Deprecated, will be removed in the future.
global _KERAS_BACKEND
global _KERAS_LAYERS
global _KERAS_MODELS
global _KERAS_UTILS
_KERAS_BACKEND = backend
_KERAS_LAYERS = layers
_KERAS_MODELS = models
_KERAS_UTILS = utils


def get_keras_submodule(name):
# Deprecated, will be removed in the future.
if name not in {'backend', 'layers', 'models', 'utils'}:
raise ImportError(
'Can only retrieve one of "backend", '
'"layers", "models", or "utils". '
'Requested: %s' % name)
if _KERAS_BACKEND is None:
raise ImportError('You need to first `import keras` '
'in order to use `keras_applications`. '
'For instance, you can do:\n\n'
'```\n'
'import keras\n'
'from keras_applications import vgg16\n'
'```\n\n'
'Or, preferably, this equivalent formulation:\n\n'
'```\n'
'from keras import applications\n'
'```\n')
if name == 'backend':
return _KERAS_BACKEND
elif name == 'layers':
return _KERAS_LAYERS
elif name == 'models':
return _KERAS_MODELS
elif name == 'utils':
return _KERAS_UTILS


def get_submodules_from_kwargs(kwargs):
backend = kwargs.get('backend', _KERAS_BACKEND)
layers = kwargs.get('layers', _KERAS_LAYERS)
Expand Down
9 changes: 4 additions & 5 deletions tests/applications_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,10 @@
def keras_modules_injection(base_fun):

def wrapper(*args, **kwargs):
if hasattr(keras_applications, 'get_submodules_from_kwargs'):
kwargs['backend'] = backend
kwargs['layers'] = layers
kwargs['models'] = models
kwargs['utils'] = utils
kwargs['backend'] = backend
kwargs['layers'] = layers
kwargs['models'] = models
kwargs['utils'] = utils
return base_fun(*args, **kwargs)
return wrapper

Expand Down

0 comments on commit 2c9b0f5

Please sign in to comment.