Remove the usages of TF private API deprecation.deprecated
.
PiperOrigin-RevId: 331570018 Change-Id: I66f398fdfc61eb414e4683897fe350fbbdd4ea0e
This commit is contained in:
parent
835f274efb
commit
499d35942a
@ -27,6 +27,7 @@ import json
|
|||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import threading
|
import threading
|
||||||
|
import warnings
|
||||||
import weakref
|
import weakref
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
@ -425,7 +426,7 @@ def set_learning_phase(value):
|
|||||||
Raises:
|
Raises:
|
||||||
ValueError: if `value` is neither `0` nor `1`.
|
ValueError: if `value` is neither `0` nor `1`.
|
||||||
"""
|
"""
|
||||||
logging.warning('`tf.keras.backend.set_learning_phase` is deprecated and '
|
warnings.warn('`tf.keras.backend.set_learning_phase` is deprecated and '
|
||||||
'will be removed after 2020-10-11. To update it, simply '
|
'will be removed after 2020-10-11. To update it, simply '
|
||||||
'pass a True/False value to the `training` argument of the '
|
'pass a True/False value to the `training` argument of the '
|
||||||
'`__call__` method of your layer or model.')
|
'`__call__` method of your layer or model.')
|
||||||
@ -483,7 +484,7 @@ def learning_phase_scope(value):
|
|||||||
Raises:
|
Raises:
|
||||||
ValueError: if `value` is neither `0` nor `1`.
|
ValueError: if `value` is neither `0` nor `1`.
|
||||||
"""
|
"""
|
||||||
logging.warning('`tf.keras.backend.learning_phase_scope` is deprecated and '
|
warnings.warn('`tf.keras.backend.learning_phase_scope` is deprecated and '
|
||||||
'will be removed after 2020-10-11. To update it, simply '
|
'will be removed after 2020-10-11. To update it, simply '
|
||||||
'pass a True/False value to the `training` argument of the '
|
'pass a True/False value to the `training` argument of the '
|
||||||
'`__call__` method of your layer or model.')
|
'`__call__` method of your layer or model.')
|
||||||
@ -6018,7 +6019,8 @@ def random_binomial(shape, p=0.0, dtype=None, seed=None):
|
|||||||
<tf.Tensor: shape=(2, 3), dtype=float32, numpy=...,
|
<tf.Tensor: shape=(2, 3), dtype=float32, numpy=...,
|
||||||
dtype=float32)>
|
dtype=float32)>
|
||||||
"""
|
"""
|
||||||
logging.warning('`tf.keras.backend.random_binomial` is deprecated. '
|
warnings.warn('`tf.keras.backend.random_binomial` is deprecated, '
|
||||||
|
'and will be removed in a future version.'
|
||||||
'Please use `tf.keras.backend.random_bernoulli` instead.')
|
'Please use `tf.keras.backend.random_bernoulli` instead.')
|
||||||
return random_bernoulli(shape, p, dtype, seed)
|
return random_bernoulli(shape, p, dtype, seed)
|
||||||
|
|
||||||
|
@ -23,6 +23,7 @@ import copy
|
|||||||
import functools
|
import functools
|
||||||
import itertools
|
import itertools
|
||||||
import threading
|
import threading
|
||||||
|
import warnings
|
||||||
import weakref
|
import weakref
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
@ -79,7 +80,6 @@ from tensorflow.python.training.tracking import data_structures
|
|||||||
from tensorflow.python.training.tracking import layer_utils as trackable_layer_utils
|
from tensorflow.python.training.tracking import layer_utils as trackable_layer_utils
|
||||||
from tensorflow.python.training.tracking import tracking
|
from tensorflow.python.training.tracking import tracking
|
||||||
from tensorflow.python.util import compat
|
from tensorflow.python.util import compat
|
||||||
from tensorflow.python.util import deprecation
|
|
||||||
from tensorflow.python.util import nest
|
from tensorflow.python.util import nest
|
||||||
from tensorflow.python.util import object_identity
|
from tensorflow.python.util import object_identity
|
||||||
from tensorflow.python.util import tf_inspect
|
from tensorflow.python.util import tf_inspect
|
||||||
@ -1370,12 +1370,11 @@ class Layer(module.Module, version_utils.LayerVersionSelector):
|
|||||||
return self.trainable_weights + self.non_trainable_weights
|
return self.trainable_weights + self.non_trainable_weights
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@deprecation.deprecated(
|
|
||||||
date=None,
|
|
||||||
instructions='This property should not be used in TensorFlow 2.0, '
|
|
||||||
'as updates are applied automatically.')
|
|
||||||
@doc_controls.do_not_generate_docs
|
@doc_controls.do_not_generate_docs
|
||||||
def updates(self):
|
def updates(self):
|
||||||
|
warnings.warn('`layer.updates` will be removed in a future version. '
|
||||||
|
'This property should not be used in TensorFlow 2.0, '
|
||||||
|
'as `updates` are applied automatically.')
|
||||||
if keras_tensor.keras_tensors_enabled():
|
if keras_tensor.keras_tensors_enabled():
|
||||||
return []
|
return []
|
||||||
|
|
||||||
@ -1895,8 +1894,6 @@ class Layer(module.Module, version_utils.LayerVersionSelector):
|
|||||||
output_weights.append(weight)
|
output_weights.append(weight)
|
||||||
return backend.batch_get_value(output_weights)
|
return backend.batch_get_value(output_weights)
|
||||||
|
|
||||||
@deprecation.deprecated(
|
|
||||||
date=None, instructions='Please use `layer.updates` instead.')
|
|
||||||
@doc_controls.do_not_generate_docs
|
@doc_controls.do_not_generate_docs
|
||||||
def get_updates_for(self, inputs):
|
def get_updates_for(self, inputs):
|
||||||
"""Deprecated, do NOT use!
|
"""Deprecated, do NOT use!
|
||||||
@ -1909,10 +1906,11 @@ class Layer(module.Module, version_utils.LayerVersionSelector):
|
|||||||
Returns:
|
Returns:
|
||||||
List of update ops of the layer that depend on `inputs`.
|
List of update ops of the layer that depend on `inputs`.
|
||||||
"""
|
"""
|
||||||
|
warnings.warn('`layer.get_updates_for` is deprecated and '
|
||||||
|
'will be removed in a future version. '
|
||||||
|
'Please use `layer.updates` method instead.')
|
||||||
return self.updates
|
return self.updates
|
||||||
|
|
||||||
@deprecation.deprecated(
|
|
||||||
date=None, instructions='Please use `layer.losses` instead.')
|
|
||||||
@doc_controls.do_not_generate_docs
|
@doc_controls.do_not_generate_docs
|
||||||
def get_losses_for(self, inputs):
|
def get_losses_for(self, inputs):
|
||||||
"""Deprecated, do NOT use!
|
"""Deprecated, do NOT use!
|
||||||
@ -1925,6 +1923,9 @@ class Layer(module.Module, version_utils.LayerVersionSelector):
|
|||||||
Returns:
|
Returns:
|
||||||
List of loss tensors of the layer that depend on `inputs`.
|
List of loss tensors of the layer that depend on `inputs`.
|
||||||
"""
|
"""
|
||||||
|
warnings.warn('`layer.get_losses_for` is deprecated and '
|
||||||
|
'will be removed in a future version. '
|
||||||
|
'Please use `layer.losses` instead.')
|
||||||
return self.losses
|
return self.losses
|
||||||
|
|
||||||
@doc_controls.do_not_doc_inheritable
|
@doc_controls.do_not_doc_inheritable
|
||||||
@ -2229,8 +2230,6 @@ class Layer(module.Module, version_utils.LayerVersionSelector):
|
|||||||
# Methods & attributes below are public aliases of other methods. #
|
# Methods & attributes below are public aliases of other methods. #
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
@deprecation.deprecated(
|
|
||||||
date=None, instructions='Please use `layer.__call__` method instead.')
|
|
||||||
@doc_controls.do_not_doc_inheritable
|
@doc_controls.do_not_doc_inheritable
|
||||||
def apply(self, inputs, *args, **kwargs):
|
def apply(self, inputs, *args, **kwargs):
|
||||||
"""Deprecated, do NOT use!
|
"""Deprecated, do NOT use!
|
||||||
@ -2245,13 +2244,17 @@ class Layer(module.Module, version_utils.LayerVersionSelector):
|
|||||||
Returns:
|
Returns:
|
||||||
Output tensor(s).
|
Output tensor(s).
|
||||||
"""
|
"""
|
||||||
|
warnings.warn('`layer.apply` is deprecated and '
|
||||||
|
'will be removed in a future version. '
|
||||||
|
'Please use `layer.__call__` method instead.')
|
||||||
return self.__call__(inputs, *args, **kwargs)
|
return self.__call__(inputs, *args, **kwargs)
|
||||||
|
|
||||||
@deprecation.deprecated(
|
|
||||||
date=None, instructions='Please use `layer.add_weight` method instead.')
|
|
||||||
@doc_controls.do_not_doc_inheritable
|
@doc_controls.do_not_doc_inheritable
|
||||||
def add_variable(self, *args, **kwargs):
|
def add_variable(self, *args, **kwargs):
|
||||||
"""Deprecated, do NOT use! Alias for `add_weight`."""
|
"""Deprecated, do NOT use! Alias for `add_weight`."""
|
||||||
|
warnings.warn('`layer.add_variable` is deprecated and '
|
||||||
|
'will be removed in a future version. '
|
||||||
|
'Please use `layer.add_weight` method instead.')
|
||||||
return self.add_weight(*args, **kwargs)
|
return self.add_weight(*args, **kwargs)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@ -22,6 +22,7 @@ import collections
|
|||||||
import functools
|
import functools
|
||||||
import itertools
|
import itertools
|
||||||
import threading
|
import threading
|
||||||
|
import warnings
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import six
|
import six
|
||||||
@ -66,7 +67,6 @@ from tensorflow.python.training.tracking import base as trackable
|
|||||||
from tensorflow.python.training.tracking import data_structures
|
from tensorflow.python.training.tracking import data_structures
|
||||||
from tensorflow.python.training.tracking import layer_utils as trackable_layer_utils
|
from tensorflow.python.training.tracking import layer_utils as trackable_layer_utils
|
||||||
from tensorflow.python.training.tracking import tracking
|
from tensorflow.python.training.tracking import tracking
|
||||||
from tensorflow.python.util import deprecation
|
|
||||||
from tensorflow.python.util import nest
|
from tensorflow.python.util import nest
|
||||||
from tensorflow.python.util import object_identity
|
from tensorflow.python.util import object_identity
|
||||||
from tensorflow.python.util import tf_inspect
|
from tensorflow.python.util import tf_inspect
|
||||||
@ -1694,8 +1694,6 @@ class Layer(base_layer.Layer):
|
|||||||
# Methods & attributes below are public aliases of other methods. #
|
# Methods & attributes below are public aliases of other methods. #
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
@deprecation.deprecated(
|
|
||||||
date=None, instructions='Please use `layer.__call__` method instead.')
|
|
||||||
@doc_controls.do_not_doc_inheritable
|
@doc_controls.do_not_doc_inheritable
|
||||||
def apply(self, inputs, *args, **kwargs):
|
def apply(self, inputs, *args, **kwargs):
|
||||||
"""Deprecated, do NOT use!
|
"""Deprecated, do NOT use!
|
||||||
@ -1710,13 +1708,17 @@ class Layer(base_layer.Layer):
|
|||||||
Returns:
|
Returns:
|
||||||
Output tensor(s).
|
Output tensor(s).
|
||||||
"""
|
"""
|
||||||
|
warnings.warn('`layer.apply` is deprecated and '
|
||||||
|
'will be removed in a future version. '
|
||||||
|
'Please use `layer.__call__` method instead.')
|
||||||
return self.__call__(inputs, *args, **kwargs)
|
return self.__call__(inputs, *args, **kwargs)
|
||||||
|
|
||||||
@deprecation.deprecated(
|
|
||||||
date=None, instructions='Please use `layer.add_weight` method instead.')
|
|
||||||
@doc_controls.do_not_doc_inheritable
|
@doc_controls.do_not_doc_inheritable
|
||||||
def add_variable(self, *args, **kwargs):
|
def add_variable(self, *args, **kwargs):
|
||||||
"""Deprecated, do NOT use! Alias for `add_weight`."""
|
"""Deprecated, do NOT use! Alias for `add_weight`."""
|
||||||
|
warnings.warn('`layer.add_variable` is deprecated and '
|
||||||
|
'will be removed in a future version. '
|
||||||
|
'Please use `layer.add_weight` method instead.')
|
||||||
return self.add_weight(*args, **kwargs)
|
return self.add_weight(*args, **kwargs)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@ -20,6 +20,7 @@ from __future__ import division
|
|||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
||||||
import copy
|
import copy
|
||||||
|
import warnings
|
||||||
|
|
||||||
from tensorflow.python import tf2
|
from tensorflow.python import tf2
|
||||||
from tensorflow.python.framework import ops
|
from tensorflow.python.framework import ops
|
||||||
@ -421,7 +422,7 @@ class Sequential(functional.Functional):
|
|||||||
Returns:
|
Returns:
|
||||||
A Numpy array of probability predictions.
|
A Numpy array of probability predictions.
|
||||||
"""
|
"""
|
||||||
logging.warning('`model.predict_proba()` is deprecated and '
|
warnings.warn('`model.predict_proba()` is deprecated and '
|
||||||
'will be removed after 2021-01-01. '
|
'will be removed after 2021-01-01. '
|
||||||
'Please use `model.predict()` instead.')
|
'Please use `model.predict()` instead.')
|
||||||
preds = self.predict(x, batch_size, verbose)
|
preds = self.predict(x, batch_size, verbose)
|
||||||
@ -446,7 +447,7 @@ class Sequential(functional.Functional):
|
|||||||
Returns:
|
Returns:
|
||||||
A numpy array of class predictions.
|
A numpy array of class predictions.
|
||||||
"""
|
"""
|
||||||
logging.warning('`model.predict_classes()` is deprecated and '
|
warnings.warn('`model.predict_classes()` is deprecated and '
|
||||||
'will be removed after 2021-01-01. '
|
'will be removed after 2021-01-01. '
|
||||||
'Please use instead:'
|
'Please use instead:'
|
||||||
'* `np.argmax(model.predict(x), axis=-1)`, '
|
'* `np.argmax(model.predict(x), axis=-1)`, '
|
||||||
|
@ -22,6 +22,7 @@ import copy
|
|||||||
import itertools
|
import itertools
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
|
import warnings
|
||||||
import six
|
import six
|
||||||
|
|
||||||
from tensorflow.python.autograph.lang import directives
|
from tensorflow.python.autograph.lang import directives
|
||||||
@ -72,7 +73,6 @@ from tensorflow.python.training.tracking import base as trackable
|
|||||||
from tensorflow.python.training.tracking import data_structures
|
from tensorflow.python.training.tracking import data_structures
|
||||||
from tensorflow.python.training.tracking import layer_utils as trackable_layer_utils
|
from tensorflow.python.training.tracking import layer_utils as trackable_layer_utils
|
||||||
from tensorflow.python.training.tracking import util as trackable_utils
|
from tensorflow.python.training.tracking import util as trackable_utils
|
||||||
from tensorflow.python.util import deprecation
|
|
||||||
from tensorflow.python.util import nest
|
from tensorflow.python.util import nest
|
||||||
from tensorflow.python.util import tf_decorator
|
from tensorflow.python.util import tf_decorator
|
||||||
from tensorflow.python.util.tf_export import keras_export
|
from tensorflow.python.util.tf_export import keras_export
|
||||||
@ -1775,8 +1775,6 @@ class Model(base_layer.Layer, version_utils.ModelVersionSelector):
|
|||||||
outputs = self.predict_function(iterator)
|
outputs = self.predict_function(iterator)
|
||||||
return tf_utils.to_numpy_or_python_type(outputs)
|
return tf_utils.to_numpy_or_python_type(outputs)
|
||||||
|
|
||||||
@deprecation.deprecated(
|
|
||||||
None, 'Please use Model.fit, which supports generators.')
|
|
||||||
def fit_generator(self,
|
def fit_generator(self,
|
||||||
generator,
|
generator,
|
||||||
steps_per_epoch=None,
|
steps_per_epoch=None,
|
||||||
@ -1798,6 +1796,9 @@ class Model(base_layer.Layer, version_utils.ModelVersionSelector):
|
|||||||
`Model.fit` now supports generators, so there is no longer any need to use
|
`Model.fit` now supports generators, so there is no longer any need to use
|
||||||
this endpoint.
|
this endpoint.
|
||||||
"""
|
"""
|
||||||
|
warnings.warn('`Model.fit_generator` is deprecated and '
|
||||||
|
'will be removed in a future version. '
|
||||||
|
'Please use `Model.fit`, which supports generators.')
|
||||||
return self.fit(
|
return self.fit(
|
||||||
generator,
|
generator,
|
||||||
steps_per_epoch=steps_per_epoch,
|
steps_per_epoch=steps_per_epoch,
|
||||||
@ -1814,8 +1815,6 @@ class Model(base_layer.Layer, version_utils.ModelVersionSelector):
|
|||||||
shuffle=shuffle,
|
shuffle=shuffle,
|
||||||
initial_epoch=initial_epoch)
|
initial_epoch=initial_epoch)
|
||||||
|
|
||||||
@deprecation.deprecated(
|
|
||||||
None, 'Please use Model.evaluate, which supports generators.')
|
|
||||||
def evaluate_generator(self,
|
def evaluate_generator(self,
|
||||||
generator,
|
generator,
|
||||||
steps=None,
|
steps=None,
|
||||||
@ -1830,6 +1829,9 @@ class Model(base_layer.Layer, version_utils.ModelVersionSelector):
|
|||||||
`Model.evaluate` now supports generators, so there is no longer any need
|
`Model.evaluate` now supports generators, so there is no longer any need
|
||||||
to use this endpoint.
|
to use this endpoint.
|
||||||
"""
|
"""
|
||||||
|
warnings.warn('`Model.evaluate_generator` is deprecated and '
|
||||||
|
'will be removed in a future version. '
|
||||||
|
'Please use `Model.evaluate`, which supports generators.')
|
||||||
self._check_call_args('evaluate_generator')
|
self._check_call_args('evaluate_generator')
|
||||||
|
|
||||||
return self.evaluate(
|
return self.evaluate(
|
||||||
@ -1841,8 +1843,6 @@ class Model(base_layer.Layer, version_utils.ModelVersionSelector):
|
|||||||
verbose=verbose,
|
verbose=verbose,
|
||||||
callbacks=callbacks)
|
callbacks=callbacks)
|
||||||
|
|
||||||
@deprecation.deprecated(
|
|
||||||
None, 'Please use Model.predict, which supports generators.')
|
|
||||||
def predict_generator(self,
|
def predict_generator(self,
|
||||||
generator,
|
generator,
|
||||||
steps=None,
|
steps=None,
|
||||||
@ -1857,6 +1857,9 @@ class Model(base_layer.Layer, version_utils.ModelVersionSelector):
|
|||||||
`Model.predict` now supports generators, so there is no longer any need
|
`Model.predict` now supports generators, so there is no longer any need
|
||||||
to use this endpoint.
|
to use this endpoint.
|
||||||
"""
|
"""
|
||||||
|
warnings.warn('`Model.predict_generator` is deprecated and '
|
||||||
|
'will be removed in a future version. '
|
||||||
|
'Please use `Model.predict`, which supports generators.')
|
||||||
return self.predict(
|
return self.predict(
|
||||||
generator,
|
generator,
|
||||||
steps=steps,
|
steps=steps,
|
||||||
@ -2270,10 +2273,6 @@ class Model(base_layer.Layer, version_utils.ModelVersionSelector):
|
|||||||
layer.reset_states()
|
layer.reset_states()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@deprecation.deprecated(
|
|
||||||
date=None,
|
|
||||||
instructions='This property should not be used in TensorFlow 2.0, '
|
|
||||||
'as updates are applied automatically.')
|
|
||||||
@doc_controls.do_not_generate_docs
|
@doc_controls.do_not_generate_docs
|
||||||
def state_updates(self):
|
def state_updates(self):
|
||||||
"""Deprecated, do NOT use!
|
"""Deprecated, do NOT use!
|
||||||
@ -2287,6 +2286,9 @@ class Model(base_layer.Layer, version_utils.ModelVersionSelector):
|
|||||||
Returns:
|
Returns:
|
||||||
A list of update ops.
|
A list of update ops.
|
||||||
"""
|
"""
|
||||||
|
warnings.warn('`Model.state_updates` will be removed in a future version. '
|
||||||
|
'This property should not be used in TensorFlow 2.0, '
|
||||||
|
'as `updates` are applied automatically.')
|
||||||
state_updates = []
|
state_updates = []
|
||||||
for layer in self.layers:
|
for layer in self.layers:
|
||||||
if getattr(layer, 'stateful', False):
|
if getattr(layer, 'stateful', False):
|
||||||
|
@ -18,6 +18,7 @@ from __future__ import division
|
|||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
||||||
import collections
|
import collections
|
||||||
|
import warnings
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
@ -61,7 +62,6 @@ from tensorflow.python.platform import tf_logging as logging
|
|||||||
from tensorflow.python.training.tracking import base as trackable
|
from tensorflow.python.training.tracking import base as trackable
|
||||||
from tensorflow.python.training.tracking import layer_utils as trackable_layer_utils
|
from tensorflow.python.training.tracking import layer_utils as trackable_layer_utils
|
||||||
from tensorflow.python.types import core
|
from tensorflow.python.types import core
|
||||||
from tensorflow.python.util import deprecation
|
|
||||||
from tensorflow.python.util import nest
|
from tensorflow.python.util import nest
|
||||||
from tensorflow.python.util import tf_inspect
|
from tensorflow.python.util import tf_inspect
|
||||||
from tensorflow.python.util.compat import collections_abc
|
from tensorflow.python.util.compat import collections_abc
|
||||||
@ -1211,8 +1211,6 @@ class Model(training_lib.Model):
|
|||||||
return outputs[0]
|
return outputs[0]
|
||||||
return outputs
|
return outputs
|
||||||
|
|
||||||
@deprecation.deprecated(
|
|
||||||
None, 'Please use Model.fit, which supports generators.')
|
|
||||||
def fit_generator(self,
|
def fit_generator(self,
|
||||||
generator,
|
generator,
|
||||||
steps_per_epoch=None,
|
steps_per_epoch=None,
|
||||||
@ -1234,6 +1232,9 @@ class Model(training_lib.Model):
|
|||||||
`Model.fit` now supports generators, so there is no longer any need to use
|
`Model.fit` now supports generators, so there is no longer any need to use
|
||||||
this endpoint.
|
this endpoint.
|
||||||
"""
|
"""
|
||||||
|
warnings.warn('`model.fit_generator` is deprecated and '
|
||||||
|
'will be removed in a future version. '
|
||||||
|
'Please use `Model.fit`, which supports generators.')
|
||||||
return self.fit(
|
return self.fit(
|
||||||
generator,
|
generator,
|
||||||
steps_per_epoch=steps_per_epoch,
|
steps_per_epoch=steps_per_epoch,
|
||||||
@ -1250,8 +1251,6 @@ class Model(training_lib.Model):
|
|||||||
shuffle=shuffle,
|
shuffle=shuffle,
|
||||||
initial_epoch=initial_epoch)
|
initial_epoch=initial_epoch)
|
||||||
|
|
||||||
@deprecation.deprecated(
|
|
||||||
None, 'Please use Model.evaluate, which supports generators.')
|
|
||||||
def evaluate_generator(self,
|
def evaluate_generator(self,
|
||||||
generator,
|
generator,
|
||||||
steps=None,
|
steps=None,
|
||||||
@ -1266,6 +1265,9 @@ class Model(training_lib.Model):
|
|||||||
`Model.evaluate` now supports generators, so there is no longer any need
|
`Model.evaluate` now supports generators, so there is no longer any need
|
||||||
to use this endpoint.
|
to use this endpoint.
|
||||||
"""
|
"""
|
||||||
|
warnings.warn('`Model.evaluate_generator` is deprecated and '
|
||||||
|
'will be removed in a future version. '
|
||||||
|
'Please use `Model.evaluate`, which supports generators.')
|
||||||
self._check_call_args('evaluate_generator')
|
self._check_call_args('evaluate_generator')
|
||||||
|
|
||||||
return self.evaluate(
|
return self.evaluate(
|
||||||
@ -1277,8 +1279,6 @@ class Model(training_lib.Model):
|
|||||||
verbose=verbose,
|
verbose=verbose,
|
||||||
callbacks=callbacks)
|
callbacks=callbacks)
|
||||||
|
|
||||||
@deprecation.deprecated(
|
|
||||||
None, 'Please use Model.predict, which supports generators.')
|
|
||||||
def predict_generator(self,
|
def predict_generator(self,
|
||||||
generator,
|
generator,
|
||||||
steps=None,
|
steps=None,
|
||||||
@ -1293,6 +1293,9 @@ class Model(training_lib.Model):
|
|||||||
`Model.predict` now supports generators, so there is no longer any need
|
`Model.predict` now supports generators, so there is no longer any need
|
||||||
to use this endpoint.
|
to use this endpoint.
|
||||||
"""
|
"""
|
||||||
|
warnings.warn('`Model.predict_generator` is deprecated and '
|
||||||
|
'will be removed in a future version. '
|
||||||
|
'Please use `Model.predict`, which supports generators.')
|
||||||
return self.predict(
|
return self.predict(
|
||||||
generator,
|
generator,
|
||||||
steps=steps,
|
steps=steps,
|
||||||
|
@ -25,6 +25,7 @@ from __future__ import division
|
|||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
||||||
import collections
|
import collections
|
||||||
|
import warnings
|
||||||
|
|
||||||
from tensorflow.python.eager import context
|
from tensorflow.python.eager import context
|
||||||
from tensorflow.python.framework import constant_op
|
from tensorflow.python.framework import constant_op
|
||||||
@ -416,7 +417,8 @@ class BasicRNNCell(LayerRNNCell):
|
|||||||
name=None,
|
name=None,
|
||||||
dtype=None,
|
dtype=None,
|
||||||
**kwargs):
|
**kwargs):
|
||||||
logging.warning("`tf.nn.rnn_cell.BasicRNNCell` is deprecated. This class "
|
warnings.warn("`tf.nn.rnn_cell.BasicRNNCell` is deprecated and will be "
|
||||||
|
"removed in a future version. This class "
|
||||||
"is equivalent as `tf.keras.layers.SimpleRNNCell`, "
|
"is equivalent as `tf.keras.layers.SimpleRNNCell`, "
|
||||||
"and will be replaced by that in Tensorflow 2.0.")
|
"and will be replaced by that in Tensorflow 2.0.")
|
||||||
super(BasicRNNCell, self).__init__(
|
super(BasicRNNCell, self).__init__(
|
||||||
@ -523,7 +525,8 @@ class GRUCell(LayerRNNCell):
|
|||||||
name=None,
|
name=None,
|
||||||
dtype=None,
|
dtype=None,
|
||||||
**kwargs):
|
**kwargs):
|
||||||
logging.warning("`tf.nn.rnn_cell.GRUCell` is deprecated. This class "
|
warnings.warn("`tf.nn.rnn_cell.GRUCell` is deprecated and will be removed "
|
||||||
|
"in a future version. This class "
|
||||||
"is equivalent as `tf.keras.layers.GRUCell`, "
|
"is equivalent as `tf.keras.layers.GRUCell`, "
|
||||||
"and will be replaced by that in Tensorflow 2.0.")
|
"and will be replaced by that in Tensorflow 2.0.")
|
||||||
super(GRUCell, self).__init__(
|
super(GRUCell, self).__init__(
|
||||||
@ -695,7 +698,8 @@ class BasicLSTMCell(LayerRNNCell):
|
|||||||
When restoring from CudnnLSTM-trained checkpoints, must use
|
When restoring from CudnnLSTM-trained checkpoints, must use
|
||||||
`CudnnCompatibleLSTMCell` instead.
|
`CudnnCompatibleLSTMCell` instead.
|
||||||
"""
|
"""
|
||||||
logging.warning("`tf.nn.rnn_cell.BasicLSTMCell` is deprecated. This class "
|
warnings.warn("`tf.nn.rnn_cell.BasicLSTMCell` is deprecated and will be "
|
||||||
|
"removed in a future version. This class "
|
||||||
"is equivalent as `tf.keras.layers.LSTMCell`, "
|
"is equivalent as `tf.keras.layers.LSTMCell`, "
|
||||||
"and will be replaced by that in Tensorflow 2.0.")
|
"and will be replaced by that in Tensorflow 2.0.")
|
||||||
super(BasicLSTMCell, self).__init__(
|
super(BasicLSTMCell, self).__init__(
|
||||||
@ -895,7 +899,8 @@ class LSTMCell(LayerRNNCell):
|
|||||||
When restoring from CudnnLSTM-trained checkpoints, use
|
When restoring from CudnnLSTM-trained checkpoints, use
|
||||||
`CudnnCompatibleLSTMCell` instead.
|
`CudnnCompatibleLSTMCell` instead.
|
||||||
"""
|
"""
|
||||||
logging.warning("`tf.nn.rnn_cell.LSTMCell` is deprecated. This class "
|
warnings.warn("`tf.nn.rnn_cell.LSTMCell` is deprecated and will be "
|
||||||
|
"removed in a future version. This class "
|
||||||
"is equivalent as `tf.keras.layers.LSTMCell`, "
|
"is equivalent as `tf.keras.layers.LSTMCell`, "
|
||||||
"and will be replaced by that in Tensorflow 2.0.")
|
"and will be replaced by that in Tensorflow 2.0.")
|
||||||
super(LSTMCell, self).__init__(
|
super(LSTMCell, self).__init__(
|
||||||
|
@ -19,6 +19,8 @@ from __future__ import absolute_import
|
|||||||
from __future__ import division
|
from __future__ import division
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
||||||
|
import warnings
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
from tensorflow.python.distribute import distribution_strategy_context as ds_context
|
from tensorflow.python.distribute import distribution_strategy_context as ds_context
|
||||||
@ -43,7 +45,6 @@ from tensorflow.python.ops import state_ops
|
|||||||
from tensorflow.python.platform import tf_logging as logging
|
from tensorflow.python.platform import tf_logging as logging
|
||||||
from tensorflow.python.training.tracking import base as trackable
|
from tensorflow.python.training.tracking import base as trackable
|
||||||
from tensorflow.python.training.tracking import data_structures
|
from tensorflow.python.training.tracking import data_structures
|
||||||
from tensorflow.python.util import deprecation
|
|
||||||
from tensorflow.python.util import nest
|
from tensorflow.python.util import nest
|
||||||
from tensorflow.python.util.compat import collections_abc
|
from tensorflow.python.util.compat import collections_abc
|
||||||
from tensorflow.python.util.tf_export import keras_export
|
from tensorflow.python.util.tf_export import keras_export
|
||||||
@ -2545,8 +2546,6 @@ class PeepholeLSTMCell(LSTMCell):
|
|||||||
```
|
```
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@deprecation.deprecated(
|
|
||||||
None, 'Please use tensorflow_addons.rnn.PeepholeLSTMCell instead')
|
|
||||||
def __init__(self,
|
def __init__(self,
|
||||||
units,
|
units,
|
||||||
activation='tanh',
|
activation='tanh',
|
||||||
@ -2565,6 +2564,10 @@ class PeepholeLSTMCell(LSTMCell):
|
|||||||
dropout=0.,
|
dropout=0.,
|
||||||
recurrent_dropout=0.,
|
recurrent_dropout=0.,
|
||||||
**kwargs):
|
**kwargs):
|
||||||
|
warnings.warn('`tf.keras.experimental.PeepholeLSTMCell` is deprecated '
|
||||||
|
'and will be removed in a future version. '
|
||||||
|
'Please use tensorflow_addons.rnn.PeepholeLSTMCell '
|
||||||
|
'instead.')
|
||||||
super(PeepholeLSTMCell, self).__init__(
|
super(PeepholeLSTMCell, self).__init__(
|
||||||
units=units,
|
units=units,
|
||||||
activation=activation,
|
activation=activation,
|
||||||
|
@ -18,6 +18,7 @@ from __future__ import division
|
|||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
||||||
import copy
|
import copy
|
||||||
|
import warnings
|
||||||
|
|
||||||
from tensorflow.python.eager import context
|
from tensorflow.python.eager import context
|
||||||
from tensorflow.python.framework import dtypes
|
from tensorflow.python.framework import dtypes
|
||||||
@ -29,7 +30,6 @@ from tensorflow.python.keras.mixed_precision.experimental import policy
|
|||||||
from tensorflow.python.ops import variable_scope as vs
|
from tensorflow.python.ops import variable_scope as vs
|
||||||
from tensorflow.python.ops import variables as tf_variables
|
from tensorflow.python.ops import variables as tf_variables
|
||||||
from tensorflow.python.training.tracking import base as trackable
|
from tensorflow.python.training.tracking import base as trackable
|
||||||
from tensorflow.python.util import deprecation
|
|
||||||
from tensorflow.python.util import function_utils
|
from tensorflow.python.util import function_utils
|
||||||
from tensorflow.python.util import nest
|
from tensorflow.python.util import nest
|
||||||
from tensorflow.python.util import tf_contextlib
|
from tensorflow.python.util import tf_contextlib
|
||||||
@ -237,11 +237,11 @@ class Layer(base_layer.Layer):
|
|||||||
# We no longer track graph in tf.layers layers. This property is only kept to
|
# We no longer track graph in tf.layers layers. This property is only kept to
|
||||||
# maintain API backward compatibility.
|
# maintain API backward compatibility.
|
||||||
@property
|
@property
|
||||||
@deprecation.deprecated(
|
|
||||||
date=None,
|
|
||||||
instructions='Stop using this property because tf.layers layers no '
|
|
||||||
'longer track their graph.')
|
|
||||||
def graph(self):
|
def graph(self):
|
||||||
|
warnings.warn('`Layer.graph` is deprecated and '
|
||||||
|
'will be removed in a future version. '
|
||||||
|
'Please stop using this property because tf.layers layers no '
|
||||||
|
'longer track their graph.')
|
||||||
if context.executing_eagerly():
|
if context.executing_eagerly():
|
||||||
raise RuntimeError('Layer.graph not supported when executing eagerly.')
|
raise RuntimeError('Layer.graph not supported when executing eagerly.')
|
||||||
return None
|
return None
|
||||||
|
@ -19,10 +19,11 @@ from __future__ import absolute_import
|
|||||||
from __future__ import division
|
from __future__ import division
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
||||||
|
import warnings
|
||||||
|
|
||||||
from tensorflow.python.keras import layers as keras_layers
|
from tensorflow.python.keras import layers as keras_layers
|
||||||
from tensorflow.python.keras.legacy_tf_layers import base
|
from tensorflow.python.keras.legacy_tf_layers import base
|
||||||
from tensorflow.python.ops import init_ops
|
from tensorflow.python.ops import init_ops
|
||||||
from tensorflow.python.util import deprecation
|
|
||||||
from tensorflow.python.util.tf_export import tf_export
|
from tensorflow.python.util.tf_export import tf_export
|
||||||
|
|
||||||
|
|
||||||
@ -118,9 +119,6 @@ class Conv1D(keras_layers.Conv1D, base.Layer):
|
|||||||
name=name, **kwargs)
|
name=name, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
@deprecation.deprecated(
|
|
||||||
date=None,
|
|
||||||
instructions='Use `tf.keras.layers.Conv1D` instead.')
|
|
||||||
@tf_export(v1=['layers.conv1d'])
|
@tf_export(v1=['layers.conv1d'])
|
||||||
def conv1d(inputs,
|
def conv1d(inputs,
|
||||||
filters,
|
filters,
|
||||||
@ -201,6 +199,9 @@ def conv1d(inputs,
|
|||||||
Raises:
|
Raises:
|
||||||
ValueError: if eager execution is enabled.
|
ValueError: if eager execution is enabled.
|
||||||
"""
|
"""
|
||||||
|
warnings.warn('`tf.layers.conv1d` is deprecated and '
|
||||||
|
'will be removed in a future version. '
|
||||||
|
'Please Use `tf.keras.layers.Conv1D` instead.')
|
||||||
layer = Conv1D(
|
layer = Conv1D(
|
||||||
filters=filters,
|
filters=filters,
|
||||||
kernel_size=kernel_size,
|
kernel_size=kernel_size,
|
||||||
@ -323,9 +324,6 @@ class Conv2D(keras_layers.Conv2D, base.Layer):
|
|||||||
name=name, **kwargs)
|
name=name, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
@deprecation.deprecated(
|
|
||||||
date=None,
|
|
||||||
instructions='Use `tf.keras.layers.Conv2D` instead.')
|
|
||||||
@tf_export(v1=['layers.conv2d'])
|
@tf_export(v1=['layers.conv2d'])
|
||||||
def conv2d(inputs,
|
def conv2d(inputs,
|
||||||
filters,
|
filters,
|
||||||
@ -413,6 +411,9 @@ def conv2d(inputs,
|
|||||||
Raises:
|
Raises:
|
||||||
ValueError: if eager execution is enabled.
|
ValueError: if eager execution is enabled.
|
||||||
"""
|
"""
|
||||||
|
warnings.warn('`tf.layers.conv2d` is deprecated and '
|
||||||
|
'will be removed in a future version. '
|
||||||
|
'Please Use `tf.keras.layers.Conv2D` instead.')
|
||||||
layer = Conv2D(
|
layer = Conv2D(
|
||||||
filters=filters,
|
filters=filters,
|
||||||
kernel_size=kernel_size,
|
kernel_size=kernel_size,
|
||||||
@ -536,9 +537,6 @@ class Conv3D(keras_layers.Conv3D, base.Layer):
|
|||||||
name=name, **kwargs)
|
name=name, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
@deprecation.deprecated(
|
|
||||||
date=None,
|
|
||||||
instructions='Use `tf.keras.layers.Conv3D` instead.')
|
|
||||||
@tf_export(v1=['layers.conv3d'])
|
@tf_export(v1=['layers.conv3d'])
|
||||||
def conv3d(inputs,
|
def conv3d(inputs,
|
||||||
filters,
|
filters,
|
||||||
@ -627,6 +625,9 @@ def conv3d(inputs,
|
|||||||
Raises:
|
Raises:
|
||||||
ValueError: if eager execution is enabled.
|
ValueError: if eager execution is enabled.
|
||||||
"""
|
"""
|
||||||
|
warnings.warn('`tf.layers.conv3d` is deprecated and '
|
||||||
|
'will be removed in a future version. '
|
||||||
|
'Please Use `tf.keras.layers.Conv3D` instead.')
|
||||||
layer = Conv3D(
|
layer = Conv3D(
|
||||||
filters=filters,
|
filters=filters,
|
||||||
kernel_size=kernel_size,
|
kernel_size=kernel_size,
|
||||||
@ -875,9 +876,6 @@ class SeparableConv2D(keras_layers.SeparableConv2D, base.Layer):
|
|||||||
**kwargs)
|
**kwargs)
|
||||||
|
|
||||||
|
|
||||||
@deprecation.deprecated(
|
|
||||||
date=None,
|
|
||||||
instructions='Use `tf.keras.layers.SeparableConv1D` instead.')
|
|
||||||
@tf_export(v1=['layers.separable_conv1d'])
|
@tf_export(v1=['layers.separable_conv1d'])
|
||||||
def separable_conv1d(inputs,
|
def separable_conv1d(inputs,
|
||||||
filters,
|
filters,
|
||||||
@ -971,6 +969,9 @@ def separable_conv1d(inputs,
|
|||||||
Raises:
|
Raises:
|
||||||
ValueError: if eager execution is enabled.
|
ValueError: if eager execution is enabled.
|
||||||
"""
|
"""
|
||||||
|
warnings.warn('`tf.layers.separable_conv1d` is deprecated and '
|
||||||
|
'will be removed in a future version. '
|
||||||
|
'Please Use `tf.keras.layers.SeparableConv1D` instead.')
|
||||||
layer = SeparableConv1D(
|
layer = SeparableConv1D(
|
||||||
filters=filters,
|
filters=filters,
|
||||||
kernel_size=kernel_size,
|
kernel_size=kernel_size,
|
||||||
@ -998,9 +999,6 @@ def separable_conv1d(inputs,
|
|||||||
return layer.apply(inputs)
|
return layer.apply(inputs)
|
||||||
|
|
||||||
|
|
||||||
@deprecation.deprecated(
|
|
||||||
date=None,
|
|
||||||
instructions='Use `tf.keras.layers.SeparableConv2D` instead.')
|
|
||||||
@tf_export(v1=['layers.separable_conv2d'])
|
@tf_export(v1=['layers.separable_conv2d'])
|
||||||
def separable_conv2d(inputs,
|
def separable_conv2d(inputs,
|
||||||
filters,
|
filters,
|
||||||
@ -1099,6 +1097,9 @@ def separable_conv2d(inputs,
|
|||||||
Raises:
|
Raises:
|
||||||
ValueError: if eager execution is enabled.
|
ValueError: if eager execution is enabled.
|
||||||
"""
|
"""
|
||||||
|
warnings.warn('`tf.layers.separable_conv2d` is deprecated and '
|
||||||
|
'will be removed in a future version. '
|
||||||
|
'Please Use `tf.keras.layers.SeparableConv2D` instead.')
|
||||||
layer = SeparableConv2D(
|
layer = SeparableConv2D(
|
||||||
filters=filters,
|
filters=filters,
|
||||||
kernel_size=kernel_size,
|
kernel_size=kernel_size,
|
||||||
@ -1214,9 +1215,6 @@ class Conv2DTranspose(keras_layers.Conv2DTranspose, base.Layer):
|
|||||||
**kwargs)
|
**kwargs)
|
||||||
|
|
||||||
|
|
||||||
@deprecation.deprecated(
|
|
||||||
date=None,
|
|
||||||
instructions='Use `tf.keras.layers.Conv2DTranspose` instead.')
|
|
||||||
@tf_export(v1=['layers.conv2d_transpose'])
|
@tf_export(v1=['layers.conv2d_transpose'])
|
||||||
def conv2d_transpose(inputs,
|
def conv2d_transpose(inputs,
|
||||||
filters,
|
filters,
|
||||||
@ -1293,6 +1291,9 @@ def conv2d_transpose(inputs,
|
|||||||
Raises:
|
Raises:
|
||||||
ValueError: if eager execution is enabled.
|
ValueError: if eager execution is enabled.
|
||||||
"""
|
"""
|
||||||
|
warnings.warn('`tf.layers.conv2d_transpose` is deprecated and '
|
||||||
|
'will be removed in a future version. '
|
||||||
|
'Please Use `tf.keras.layers.Conv2DTranspose` instead.')
|
||||||
layer = Conv2DTranspose(
|
layer = Conv2DTranspose(
|
||||||
filters=filters,
|
filters=filters,
|
||||||
kernel_size=kernel_size,
|
kernel_size=kernel_size,
|
||||||
@ -1400,9 +1401,6 @@ class Conv3DTranspose(keras_layers.Conv3DTranspose, base.Layer):
|
|||||||
**kwargs)
|
**kwargs)
|
||||||
|
|
||||||
|
|
||||||
@deprecation.deprecated(
|
|
||||||
date=None,
|
|
||||||
instructions='Use `tf.keras.layers.Conv3DTranspose` instead.')
|
|
||||||
@tf_export(v1=['layers.conv3d_transpose'])
|
@tf_export(v1=['layers.conv3d_transpose'])
|
||||||
def conv3d_transpose(inputs,
|
def conv3d_transpose(inputs,
|
||||||
filters,
|
filters,
|
||||||
@ -1473,6 +1471,9 @@ def conv3d_transpose(inputs,
|
|||||||
Raises:
|
Raises:
|
||||||
ValueError: if eager execution is enabled.
|
ValueError: if eager execution is enabled.
|
||||||
"""
|
"""
|
||||||
|
warnings.warn('`tf.layers.conv3d_transpose` is deprecated and '
|
||||||
|
'will be removed in a future version. '
|
||||||
|
'Please Use `tf.keras.layers.Conv3DTranspose` instead.')
|
||||||
layer = Conv3DTranspose(
|
layer = Conv3DTranspose(
|
||||||
filters=filters,
|
filters=filters,
|
||||||
kernel_size=kernel_size,
|
kernel_size=kernel_size,
|
||||||
|
@ -21,11 +21,11 @@ from __future__ import absolute_import
|
|||||||
from __future__ import division
|
from __future__ import division
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
||||||
|
import warnings
|
||||||
|
|
||||||
from tensorflow.python.keras import layers as keras_layers
|
from tensorflow.python.keras import layers as keras_layers
|
||||||
from tensorflow.python.keras.legacy_tf_layers import base
|
from tensorflow.python.keras.legacy_tf_layers import base
|
||||||
from tensorflow.python.ops import init_ops
|
from tensorflow.python.ops import init_ops
|
||||||
from tensorflow.python.util import deprecation
|
|
||||||
from tensorflow.python.util.tf_export import tf_export
|
from tensorflow.python.util.tf_export import tf_export
|
||||||
|
|
||||||
|
|
||||||
@ -110,8 +110,6 @@ class Dense(keras_layers.Dense, base.Layer):
|
|||||||
**kwargs)
|
**kwargs)
|
||||||
|
|
||||||
|
|
||||||
@deprecation.deprecated(
|
|
||||||
date=None, instructions='Use keras.layers.Dense instead.')
|
|
||||||
@tf_export(v1=['layers.dense'])
|
@tf_export(v1=['layers.dense'])
|
||||||
def dense(
|
def dense(
|
||||||
inputs, units,
|
inputs, units,
|
||||||
@ -170,6 +168,9 @@ def dense(
|
|||||||
Raises:
|
Raises:
|
||||||
ValueError: if eager execution is enabled.
|
ValueError: if eager execution is enabled.
|
||||||
"""
|
"""
|
||||||
|
warnings.warn('`tf.layers.dense` is deprecated and '
|
||||||
|
'will be removed in a future version. '
|
||||||
|
'Please use `tf.keras.layers.Dense` instead.')
|
||||||
layer = Dense(units,
|
layer = Dense(units,
|
||||||
activation=activation,
|
activation=activation,
|
||||||
use_bias=use_bias,
|
use_bias=use_bias,
|
||||||
@ -226,9 +227,6 @@ class Dropout(keras_layers.Dropout, base.Layer):
|
|||||||
return super(Dropout, self).call(inputs, training=training)
|
return super(Dropout, self).call(inputs, training=training)
|
||||||
|
|
||||||
|
|
||||||
@deprecation.deprecated(
|
|
||||||
date=None,
|
|
||||||
instructions='Use keras.layers.dropout instead.')
|
|
||||||
@tf_export(v1=['layers.dropout'])
|
@tf_export(v1=['layers.dropout'])
|
||||||
def dropout(inputs,
|
def dropout(inputs,
|
||||||
rate=0.5,
|
rate=0.5,
|
||||||
@ -267,6 +265,9 @@ def dropout(inputs,
|
|||||||
Raises:
|
Raises:
|
||||||
ValueError: if eager execution is enabled.
|
ValueError: if eager execution is enabled.
|
||||||
"""
|
"""
|
||||||
|
warnings.warn('`tf.layers.dropout` is deprecated and '
|
||||||
|
'will be removed in a future version. '
|
||||||
|
'Please use `tf.keras.layers.Dropout` instead.')
|
||||||
layer = Dropout(rate, noise_shape=noise_shape, seed=seed, name=name)
|
layer = Dropout(rate, noise_shape=noise_shape, seed=seed, name=name)
|
||||||
return layer.apply(inputs, training=training)
|
return layer.apply(inputs, training=training)
|
||||||
|
|
||||||
@ -297,9 +298,6 @@ class Flatten(keras_layers.Flatten, base.Layer):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
@deprecation.deprecated(
|
|
||||||
date=None,
|
|
||||||
instructions='Use keras.layers.Flatten instead.')
|
|
||||||
@tf_export(v1=['layers.flatten'])
|
@tf_export(v1=['layers.flatten'])
|
||||||
def flatten(inputs, name=None, data_format='channels_last'):
|
def flatten(inputs, name=None, data_format='channels_last'):
|
||||||
"""Flattens an input tensor while preserving the batch axis (axis 0).
|
"""Flattens an input tensor while preserving the batch axis (axis 0).
|
||||||
@ -328,6 +326,9 @@ def flatten(inputs, name=None, data_format='channels_last'):
|
|||||||
# now `y` has shape `(None, None)`
|
# now `y` has shape `(None, None)`
|
||||||
```
|
```
|
||||||
"""
|
"""
|
||||||
|
warnings.warn('`tf.layers.flatten` is deprecated and '
|
||||||
|
'will be removed in a future version. '
|
||||||
|
'Please use `tf.keras.layers.Flatten` instead.')
|
||||||
layer = Flatten(name=name, data_format=data_format)
|
layer = Flatten(name=name, data_format=data_format)
|
||||||
return layer.apply(inputs)
|
return layer.apply(inputs)
|
||||||
|
|
||||||
|
@ -19,11 +19,11 @@ from __future__ import absolute_import
|
|||||||
from __future__ import division
|
from __future__ import division
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
||||||
|
import warnings
|
||||||
|
|
||||||
from tensorflow.python.keras.layers import normalization as keras_normalization
|
from tensorflow.python.keras.layers import normalization as keras_normalization
|
||||||
from tensorflow.python.keras.legacy_tf_layers import base
|
from tensorflow.python.keras.legacy_tf_layers import base
|
||||||
from tensorflow.python.ops import init_ops
|
from tensorflow.python.ops import init_ops
|
||||||
from tensorflow.python.util import deprecation
|
|
||||||
from tensorflow.python.util.tf_export import tf_export
|
from tensorflow.python.util.tf_export import tf_export
|
||||||
|
|
||||||
|
|
||||||
@ -172,11 +172,6 @@ class BatchNormalization(keras_normalization.BatchNormalization, base.Layer):
|
|||||||
return super(BatchNormalization, self).call(inputs, training=training)
|
return super(BatchNormalization, self).call(inputs, training=training)
|
||||||
|
|
||||||
|
|
||||||
@deprecation.deprecated(
|
|
||||||
date=None, instructions='Use keras.layers.BatchNormalization instead. In '
|
|
||||||
'particular, `tf.control_dependencies(tf.GraphKeys.UPDATE_OPS)` should not '
|
|
||||||
'be used (consult the `tf.keras.layers.BatchNormalization` '
|
|
||||||
'documentation).')
|
|
||||||
@tf_export(v1=['layers.batch_normalization'])
|
@tf_export(v1=['layers.batch_normalization'])
|
||||||
def batch_normalization(inputs,
|
def batch_normalization(inputs,
|
||||||
axis=-1,
|
axis=-1,
|
||||||
@ -309,6 +304,13 @@ def batch_normalization(inputs,
|
|||||||
2017](http://papers.nips.cc/paper/6790-batch-renormalization-towards-reducing-minibatch-dependence-in-batch-normalized-models)
|
2017](http://papers.nips.cc/paper/6790-batch-renormalization-towards-reducing-minibatch-dependence-in-batch-normalized-models)
|
||||||
([pdf](http://papers.nips.cc/paper/6790-batch-renormalization-towards-reducing-minibatch-dependence-in-batch-normalized-models.pdf))
|
([pdf](http://papers.nips.cc/paper/6790-batch-renormalization-towards-reducing-minibatch-dependence-in-batch-normalized-models.pdf))
|
||||||
"""
|
"""
|
||||||
|
warnings.warn(
|
||||||
|
'`tf.layers.batch_normalization` is deprecated and '
|
||||||
|
'will be removed in a future version. '
|
||||||
|
'Please use `tf.keras.layers.BatchNormalization` instead. '
|
||||||
|
'In particular, `tf.control_dependencies(tf.GraphKeys.UPDATE_OPS)` '
|
||||||
|
'should not be used (consult the `tf.keras.layers.BatchNormalization` '
|
||||||
|
'documentation).')
|
||||||
layer = BatchNormalization(
|
layer = BatchNormalization(
|
||||||
axis=axis,
|
axis=axis,
|
||||||
momentum=momentum,
|
momentum=momentum,
|
||||||
|
@ -19,9 +19,10 @@ from __future__ import absolute_import
|
|||||||
from __future__ import division
|
from __future__ import division
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
||||||
|
import warnings
|
||||||
|
|
||||||
from tensorflow.python.keras import layers as keras_layers
|
from tensorflow.python.keras import layers as keras_layers
|
||||||
from tensorflow.python.keras.legacy_tf_layers import base
|
from tensorflow.python.keras.legacy_tf_layers import base
|
||||||
from tensorflow.python.util import deprecation
|
|
||||||
from tensorflow.python.util.tf_export import tf_export
|
from tensorflow.python.util.tf_export import tf_export
|
||||||
|
|
||||||
|
|
||||||
@ -58,8 +59,6 @@ class AveragePooling1D(keras_layers.AveragePooling1D, base.Layer):
|
|||||||
**kwargs)
|
**kwargs)
|
||||||
|
|
||||||
|
|
||||||
@deprecation.deprecated(
|
|
||||||
date=None, instructions='Use keras.layers.AveragePooling1D instead.')
|
|
||||||
@tf_export(v1=['layers.average_pooling1d'])
|
@tf_export(v1=['layers.average_pooling1d'])
|
||||||
def average_pooling1d(inputs, pool_size, strides,
|
def average_pooling1d(inputs, pool_size, strides,
|
||||||
padding='valid', data_format='channels_last',
|
padding='valid', data_format='channels_last',
|
||||||
@ -87,6 +86,9 @@ def average_pooling1d(inputs, pool_size, strides,
|
|||||||
Raises:
|
Raises:
|
||||||
ValueError: if eager execution is enabled.
|
ValueError: if eager execution is enabled.
|
||||||
"""
|
"""
|
||||||
|
warnings.warn('`tf.layers.average_pooling1d` is deprecated and '
|
||||||
|
'will be removed in a future version. '
|
||||||
|
'Please use `tf.keras.layers.AveragePooling1D` instead.')
|
||||||
layer = AveragePooling1D(pool_size=pool_size,
|
layer = AveragePooling1D(pool_size=pool_size,
|
||||||
strides=strides,
|
strides=strides,
|
||||||
padding=padding,
|
padding=padding,
|
||||||
@ -128,8 +130,6 @@ class MaxPooling1D(keras_layers.MaxPooling1D, base.Layer):
|
|||||||
**kwargs)
|
**kwargs)
|
||||||
|
|
||||||
|
|
||||||
@deprecation.deprecated(
|
|
||||||
date=None, instructions='Use keras.layers.MaxPooling1D instead.')
|
|
||||||
@tf_export(v1=['layers.max_pooling1d'])
|
@tf_export(v1=['layers.max_pooling1d'])
|
||||||
def max_pooling1d(inputs, pool_size, strides,
|
def max_pooling1d(inputs, pool_size, strides,
|
||||||
padding='valid', data_format='channels_last',
|
padding='valid', data_format='channels_last',
|
||||||
@ -157,6 +157,9 @@ def max_pooling1d(inputs, pool_size, strides,
|
|||||||
Raises:
|
Raises:
|
||||||
ValueError: if eager execution is enabled.
|
ValueError: if eager execution is enabled.
|
||||||
"""
|
"""
|
||||||
|
warnings.warn('`tf.layers.max_pooling1d` is deprecated and '
|
||||||
|
'will be removed in a future version. '
|
||||||
|
'Please use `tf.keras.layers.MaxPooling1D` instead.')
|
||||||
layer = MaxPooling1D(pool_size=pool_size,
|
layer = MaxPooling1D(pool_size=pool_size,
|
||||||
strides=strides,
|
strides=strides,
|
||||||
padding=padding,
|
padding=padding,
|
||||||
@ -198,8 +201,6 @@ class AveragePooling2D(keras_layers.AveragePooling2D, base.Layer):
|
|||||||
padding=padding, data_format=data_format, name=name, **kwargs)
|
padding=padding, data_format=data_format, name=name, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
@deprecation.deprecated(
|
|
||||||
date=None, instructions='Use keras.layers.AveragePooling2D instead.')
|
|
||||||
@tf_export(v1=['layers.average_pooling2d'])
|
@tf_export(v1=['layers.average_pooling2d'])
|
||||||
def average_pooling2d(inputs,
|
def average_pooling2d(inputs,
|
||||||
pool_size, strides,
|
pool_size, strides,
|
||||||
@ -232,6 +233,9 @@ def average_pooling2d(inputs,
|
|||||||
Raises:
|
Raises:
|
||||||
ValueError: if eager execution is enabled.
|
ValueError: if eager execution is enabled.
|
||||||
"""
|
"""
|
||||||
|
warnings.warn('`tf.layers.average_pooling2d` is deprecated and '
|
||||||
|
'will be removed in a future version. '
|
||||||
|
'Please use `tf.keras.layers.AveragePooling2D` instead.')
|
||||||
layer = AveragePooling2D(pool_size=pool_size, strides=strides,
|
layer = AveragePooling2D(pool_size=pool_size, strides=strides,
|
||||||
padding=padding, data_format=data_format,
|
padding=padding, data_format=data_format,
|
||||||
name=name)
|
name=name)
|
||||||
@ -271,8 +275,6 @@ class MaxPooling2D(keras_layers.MaxPooling2D, base.Layer):
|
|||||||
padding=padding, data_format=data_format, name=name, **kwargs)
|
padding=padding, data_format=data_format, name=name, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
@deprecation.deprecated(
|
|
||||||
date=None, instructions='Use keras.layers.MaxPooling2D instead.')
|
|
||||||
@tf_export(v1=['layers.max_pooling2d'])
|
@tf_export(v1=['layers.max_pooling2d'])
|
||||||
def max_pooling2d(inputs,
|
def max_pooling2d(inputs,
|
||||||
pool_size, strides,
|
pool_size, strides,
|
||||||
@ -305,6 +307,9 @@ def max_pooling2d(inputs,
|
|||||||
Raises:
|
Raises:
|
||||||
ValueError: if eager execution is enabled.
|
ValueError: if eager execution is enabled.
|
||||||
"""
|
"""
|
||||||
|
warnings.warn('`tf.layers.max_pooling2d` is deprecated and '
|
||||||
|
'will be removed in a future version. '
|
||||||
|
'Please use `tf.keras.layers.MaxPooling2D` instead.')
|
||||||
layer = MaxPooling2D(pool_size=pool_size, strides=strides,
|
layer = MaxPooling2D(pool_size=pool_size, strides=strides,
|
||||||
padding=padding, data_format=data_format,
|
padding=padding, data_format=data_format,
|
||||||
name=name)
|
name=name)
|
||||||
@ -346,8 +351,6 @@ class AveragePooling3D(keras_layers.AveragePooling3D, base.Layer):
|
|||||||
padding=padding, data_format=data_format, name=name, **kwargs)
|
padding=padding, data_format=data_format, name=name, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
@deprecation.deprecated(
|
|
||||||
date=None, instructions='Use keras.layers.AveragePooling3D instead.')
|
|
||||||
@tf_export(v1=['layers.average_pooling3d'])
|
@tf_export(v1=['layers.average_pooling3d'])
|
||||||
def average_pooling3d(inputs,
|
def average_pooling3d(inputs,
|
||||||
pool_size, strides,
|
pool_size, strides,
|
||||||
@ -382,6 +385,9 @@ def average_pooling3d(inputs,
|
|||||||
Raises:
|
Raises:
|
||||||
ValueError: if eager execution is enabled.
|
ValueError: if eager execution is enabled.
|
||||||
"""
|
"""
|
||||||
|
warnings.warn('`tf.layers.average_pooling3d` is deprecated and '
|
||||||
|
'will be removed in a future version. '
|
||||||
|
'Please use `tf.keras.layers.AveragePooling3D` instead.')
|
||||||
layer = AveragePooling3D(pool_size=pool_size, strides=strides,
|
layer = AveragePooling3D(pool_size=pool_size, strides=strides,
|
||||||
padding=padding, data_format=data_format,
|
padding=padding, data_format=data_format,
|
||||||
name=name)
|
name=name)
|
||||||
@ -423,8 +429,6 @@ class MaxPooling3D(keras_layers.MaxPooling3D, base.Layer):
|
|||||||
padding=padding, data_format=data_format, name=name, **kwargs)
|
padding=padding, data_format=data_format, name=name, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
@deprecation.deprecated(
|
|
||||||
date=None, instructions='Use keras.layers.MaxPooling3D instead.')
|
|
||||||
@tf_export(v1=['layers.max_pooling3d'])
|
@tf_export(v1=['layers.max_pooling3d'])
|
||||||
def max_pooling3d(inputs,
|
def max_pooling3d(inputs,
|
||||||
pool_size, strides,
|
pool_size, strides,
|
||||||
@ -457,6 +461,9 @@ def max_pooling3d(inputs,
|
|||||||
Raises:
|
Raises:
|
||||||
ValueError: if eager execution is enabled.
|
ValueError: if eager execution is enabled.
|
||||||
"""
|
"""
|
||||||
|
warnings.warn('`tf.layers.max_pooling3d` is deprecated and '
|
||||||
|
'will be removed in a future version. '
|
||||||
|
'Please use `tf.keras.layers.MaxPooling3D` instead.')
|
||||||
layer = MaxPooling3D(pool_size=pool_size, strides=strides,
|
layer = MaxPooling3D(pool_size=pool_size, strides=strides,
|
||||||
padding=padding, data_format=data_format,
|
padding=padding, data_format=data_format,
|
||||||
name=name)
|
name=name)
|
||||||
|
@ -18,6 +18,7 @@ from __future__ import division
|
|||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
import warnings
|
||||||
|
|
||||||
import six
|
import six
|
||||||
|
|
||||||
@ -41,7 +42,6 @@ from tensorflow.python.saved_model import utils_impl as saved_model_utils
|
|||||||
from tensorflow.python.training import saver as saver_lib
|
from tensorflow.python.training import saver as saver_lib
|
||||||
from tensorflow.python.training.tracking import graph_view
|
from tensorflow.python.training.tracking import graph_view
|
||||||
from tensorflow.python.util import compat
|
from tensorflow.python.util import compat
|
||||||
from tensorflow.python.util import deprecation
|
|
||||||
from tensorflow.python.util import nest
|
from tensorflow.python.util import nest
|
||||||
from tensorflow.python.util.tf_export import keras_export
|
from tensorflow.python.util.tf_export import keras_export
|
||||||
|
|
||||||
@ -61,10 +61,6 @@ sequential = LazyLoader(
|
|||||||
# pylint:enable=g-inconsistent-quotes
|
# pylint:enable=g-inconsistent-quotes
|
||||||
|
|
||||||
|
|
||||||
@deprecation.deprecated(
|
|
||||||
date=None,
|
|
||||||
instructions=('Please use `model.save(..., save_format="tf")` or '
|
|
||||||
'`tf.keras.models.save_model(..., save_format="tf")`.'))
|
|
||||||
@keras_export(v1=['keras.experimental.export_saved_model'])
|
@keras_export(v1=['keras.experimental.export_saved_model'])
|
||||||
def export_saved_model(model,
|
def export_saved_model(model,
|
||||||
saved_model_path,
|
saved_model_path,
|
||||||
@ -130,6 +126,10 @@ def export_saved_model(model,
|
|||||||
ValueError: If the input signature cannot be inferred from the model.
|
ValueError: If the input signature cannot be inferred from the model.
|
||||||
AssertionError: If the SavedModel directory already exists and isn't empty.
|
AssertionError: If the SavedModel directory already exists and isn't empty.
|
||||||
"""
|
"""
|
||||||
|
warnings.warn('`tf.keras.experimental.export_saved_model` is deprecated'
|
||||||
|
'and will be removed in a future version. '
|
||||||
|
'Please use `model.save(..., save_format="tf")` or '
|
||||||
|
'`tf.keras.models.save_model(..., save_format="tf")`.')
|
||||||
if serving_only:
|
if serving_only:
|
||||||
save_lib.save(
|
save_lib.save(
|
||||||
model,
|
model,
|
||||||
@ -372,10 +372,6 @@ def _assert_same_non_optimizer_objects(model, model_graph, clone, clone_graph):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
@deprecation.deprecated(
|
|
||||||
date=None,
|
|
||||||
instructions=('The experimental save and load functions have been '
|
|
||||||
'deprecated. Please switch to `tf.keras.models.load_model`.'))
|
|
||||||
@keras_export(v1=['keras.experimental.load_from_saved_model'])
|
@keras_export(v1=['keras.experimental.load_from_saved_model'])
|
||||||
def load_from_saved_model(saved_model_path, custom_objects=None):
|
def load_from_saved_model(saved_model_path, custom_objects=None):
|
||||||
"""Loads a keras Model from a SavedModel created by `export_saved_model()`.
|
"""Loads a keras Model from a SavedModel created by `export_saved_model()`.
|
||||||
@ -413,6 +409,9 @@ def load_from_saved_model(saved_model_path, custom_objects=None):
|
|||||||
Returns:
|
Returns:
|
||||||
a keras.Model instance.
|
a keras.Model instance.
|
||||||
"""
|
"""
|
||||||
|
warnings.warn('`tf.keras.experimental.load_from_saved_model` is deprecated'
|
||||||
|
'and will be removed in a future version. '
|
||||||
|
'Please switch to `tf.keras.models.load_model`.')
|
||||||
# restore model topology from json string
|
# restore model topology from json string
|
||||||
model_json_filepath = os.path.join(
|
model_json_filepath = os.path.join(
|
||||||
compat.as_bytes(saved_model_path),
|
compat.as_bytes(saved_model_path),
|
||||||
|
Loading…
Reference in New Issue
Block a user