diff --git a/keras_applications/__init__.py b/keras_applications/__init__.py index d7b88b2..be26d9c 100644 --- a/keras_applications/__init__.py +++ b/keras_applications/__init__.py @@ -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) diff --git a/tests/applications_test.py b/tests/applications_test.py index 8195cf7..dcfc0ac 100644 --- a/tests/applications_test.py +++ b/tests/applications_test.py @@ -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