• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2019 The TensorFlow Authors. All Rights Reserved.
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#     http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14# ==============================================================================
15"""Module deprecation warnings for TensorFlow 2.0."""
16
17from tensorflow.tools.compatibility import ast_edits
18
19
20_CONTRIB_WARNING = (
21    ast_edits.ERROR,
22    "<function name> cannot be converted automatically. tf.contrib will not"
23    " be distributed with TensorFlow 2.0, please consider an alternative in"
24    " non-contrib TensorFlow, a community-maintained repository such as "
25    "tensorflow/addons, or fork the required code.")
26
27_FLAGS_WARNING = (
28    ast_edits.ERROR,
29    "tf.flags and tf.app.flags have been removed, please use the argparse or "
30    "absl modules if you need command line parsing.")
31
32_CONTRIB_CUDNN_RNN_WARNING = (
33    ast_edits.WARNING,
34    "(Manual edit required) tf.contrib.cudnn_rnn.* has been deprecated, "
35    "and the CuDNN kernel has been integrated with "
36    "tf.keras.layers.LSTM/GRU in TensorFlow 2.0. Please check the new API "
37    "and use that instead."
38)
39
40_CONTRIB_RNN_WARNING = (
41    ast_edits.WARNING,
42    "(Manual edit required) tf.contrib.rnn.* has been deprecated, and "
43    "widely used cells/functions will be moved to tensorflow/addons "
44    "repository. Please check it there and file Github issues if necessary."
45)
46
47_CONTRIB_DIST_STRAT_WARNING = (
48    ast_edits.WARNING,
49    "(Manual edit required) tf.contrib.distribute.* have been migrated to "
50    "tf.distribute.*. Please check out the new module for updated APIs.")
51
52_CONTRIB_SEQ2SEQ_WARNING = (
53    ast_edits.WARNING,
54    "(Manual edit required) tf.contrib.seq2seq.* have been migrated to "
55    "`tfa.seq2seq.*` in TensorFlow Addons. Please see "
56    "https://github.com/tensorflow/addons for more info.")
57
58MODULE_DEPRECATIONS = {
59    "tf.contrib": _CONTRIB_WARNING,
60    "tf.contrib.cudnn_rnn": _CONTRIB_CUDNN_RNN_WARNING,
61    "tf.contrib.rnn": _CONTRIB_RNN_WARNING,
62    "tf.flags": _FLAGS_WARNING,
63    "tf.app.flags": _FLAGS_WARNING,
64    "tf.contrib.distribute": _CONTRIB_DIST_STRAT_WARNING,
65    "tf.contrib.seq2seq": _CONTRIB_SEQ2SEQ_WARNING
66}
67