Adding tf.flags to the converter script. The flags endpoint is deprecated so we need to use the compatibility module to convert it.

PiperOrigin-RevId: 275177625
Change-Id: I436796a455675a0f2c29c6d9be3eb64bc3a57fec
This commit is contained in:
Amit Patankar 2019-10-16 21:16:51 -07:00 committed by TensorFlower Gardener
parent 0a0dbde0a4
commit 08cc5a44f3
3 changed files with 13 additions and 5 deletions

View File

@ -30,9 +30,8 @@ _CONTRIB_WARNING = (
_FLAGS_WARNING = (
ast_edits.ERROR,
"tf.flags has been removed, please use the argparse or absl"
" modules if you need command line parsing."
)
"tf.flags and tf.app.flags have been removed, please use the argparse or "
"absl modules if you need command line parsing.")
_CONTRIB_CUDNN_RNN_WARNING = (
ast_edits.WARNING,
@ -65,6 +64,7 @@ MODULE_DEPRECATIONS = {
"tf.contrib.cudnn_rnn": _CONTRIB_CUDNN_RNN_WARNING,
"tf.contrib.rnn": _CONTRIB_RNN_WARNING,
"tf.flags": _FLAGS_WARNING,
"tf.app.flags": _FLAGS_WARNING,
"tf.contrib.distribute": _CONTRIB_DIST_STRAT_WARNING,
"tf.contrib.seq2seq": _CONTRIB_SEQ2SEQ_WARNING
}

View File

@ -154,6 +154,8 @@ renames = {
'tf.math.angle',
'tf.app.run':
'tf.compat.v1.app.run',
'tf.app.flags':
'tf.compat.v1.app.flags',
'tf.assert_greater_equal':
'tf.compat.v1.assert_greater_equal',
'tf.assert_integer':

View File

@ -1658,11 +1658,11 @@ def _log_prob(self, x):
def test_flags_bare(self):
_, _, errors, _ = self._upgrade("tf.flags")
self.assertIn("tf.flags has been removed", errors[0])
self.assertIn("tf.flags and tf.app.flags have been removed", errors[0])
def test_flags_flags(self):
_, _, errors, _ = self._upgrade("tf.flags.FLAGS")
self.assertIn("tf.flags has been removed", errors[0])
self.assertIn("tf.flags and tf.app.flags have been removed", errors[0])
def test_contrib_estimator_head_deprecation(self):
api_symbols = ["binary_classification_head", "logistic_regression_head",
@ -1916,6 +1916,12 @@ def _log_prob(self, x):
_, _, _, new_text = self._upgrade(text)
self.assertEqual(expected, new_text)
def test_app_flags(self):
text = "flags = tf.app.flags"
expected = "flags = tf.compat.v1.app.flags"
_, _, _, new_text = self._upgrade(text)
self.assertEqual(expected, new_text)
def test_uniform_unit_scaling_initializer(self):
text = "tf.uniform_unit_scaling_initializer(0.5)"
expected_text = ("tf.compat.v1.keras.initializers.VarianceScaling("