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 __future__ import absolute_import 18from __future__ import division 19from __future__ import print_function 20 21from tensorflow.tools.compatibility import ast_edits 22 23 24_CONTRIB_WARNING = ( 25 ast_edits.ERROR, 26 "<function name> cannot be converted automatically. tf.contrib will not" 27 " be distributed with TensorFlow 2.0, please consider an alternative in" 28 " non-contrib TensorFlow, a community-maintained repository such as " 29 "tensorflow/addons, or fork the required code.") 30 31_FLAGS_WARNING = ( 32 ast_edits.ERROR, 33 "tf.flags and tf.app.flags have been removed, please use the argparse or " 34 "absl modules if you need command line parsing.") 35 36_CONTRIB_CUDNN_RNN_WARNING = ( 37 ast_edits.WARNING, 38 "(Manual edit required) tf.contrib.cudnn_rnn.* has been deprecated, " 39 "and the CuDNN kernel has been integrated with " 40 "tf.keras.layers.LSTM/GRU in TensorFlow 2.0. Please check the new API " 41 "and use that instead." 42) 43 44_CONTRIB_RNN_WARNING = ( 45 ast_edits.WARNING, 46 "(Manual edit required) tf.contrib.rnn.* has been deprecated, and " 47 "widely used cells/functions will be moved to tensorflow/addons " 48 "repository. Please check it there and file Github issues if necessary." 49) 50 51_CONTRIB_DIST_STRAT_WARNING = ( 52 ast_edits.WARNING, 53 "(Manual edit required) tf.contrib.distribute.* have been migrated to " 54 "tf.distribute.*. Please check out the new module for updated APIs.") 55 56_CONTRIB_SEQ2SEQ_WARNING = ( 57 ast_edits.WARNING, 58 "(Manual edit required) tf.contrib.seq2seq.* have been migrated to " 59 "`tfa.seq2seq.*` in TensorFlow Addons. Please see " 60 "https://github.com/tensorflow/addons for more info.") 61 62MODULE_DEPRECATIONS = { 63 "tf.contrib": _CONTRIB_WARNING, 64 "tf.contrib.cudnn_rnn": _CONTRIB_CUDNN_RNN_WARNING, 65 "tf.contrib.rnn": _CONTRIB_RNN_WARNING, 66 "tf.flags": _FLAGS_WARNING, 67 "tf.app.flags": _FLAGS_WARNING, 68 "tf.contrib.distribute": _CONTRIB_DIST_STRAT_WARNING, 69 "tf.contrib.seq2seq": _CONTRIB_SEQ2SEQ_WARNING 70} 71