From 4890b781b6b77fcc6c751d351c2f320ef9043e8d Mon Sep 17 00:00:00 2001 From: Gaurav Jain Date: Fri, 7 Dec 2018 17:36:37 -0800 Subject: [PATCH] Annotate tests as @run_v1_only Skip individual test cases or entire suites that are not running in v1. Also replace some @run_deprecated_v1 annotations since simply running the test in graph mode was not enough. PiperOrigin-RevId: 224604547 --- .../audio_microfrontend_op_test.py | 5 + .../lite/python/convert_saved_model_test.py | 7 ++ tensorflow/lite/python/convert_test.py | 2 + tensorflow/lite/python/lite_test.py | 4 + .../model_coverage/model_coverage_lib_test.py | 10 ++ tensorflow/python/autograph/impl/api_test.py | 1 + tensorflow/python/client/session_test.py | 23 ++++ .../data/kernel_tests/interleave_test.py | 2 + .../kernel_tests/iterator_cluster_test.py | 5 + .../python/data/kernel_tests/map_test.py | 2 + .../multi_device_iterator_test.py | 9 ++ .../python/debug/cli/analyzer_cli_test.py | 36 +----- .../python/debug/cli/cli_shared_test.py | 3 +- .../debug/cli/profile_analyzer_cli_test.py | 7 +- .../python/debug/cli/stepper_cli_test.py | 1 + .../python/debug/lib/debug_gradients_test.py | 15 +-- .../python/debug/lib/debug_utils_test.py | 20 +-- .../debug/lib/dist_session_debug_grpc_test.py | 1 + .../debug/lib/session_debug_file_test.py | 2 +- .../debug/lib/session_debug_grpc_test.py | 3 + .../python/debug/lib/session_debug_testlib.py | 1 + .../python/debug/lib/source_utils_test.py | 1 + tensorflow/python/debug/lib/stepper_test.py | 4 + .../python/debug/wrappers/disk_usage_test.py | 1 + .../debug/wrappers/dumping_wrapper_test.py | 1 + .../python/debug/wrappers/framework_test.py | 1 + .../debug/wrappers/local_cli_wrapper_test.py | 1 + .../distribute/distribute_coordinator_test.py | 2 + tensorflow/python/eager/backprop_test.py | 19 +++ .../python/eager/function_gradients_test.py | 2 +- tensorflow/python/eager/function_test.py | 2 + .../framework/auto_control_deps_test.py | 7 ++ .../framework/error_interpolation_test.py | 8 ++ .../python/framework/graph_util_test.py | 2 +- .../python/framework/meta_graph_test.py | 2 +- tensorflow/python/framework/ops_test.py | 13 +- tensorflow/python/framework/subscribe_test.py | 6 +- tensorflow/python/grappler/item_test.py | 2 +- .../python/grappler/memory_optimizer_test.py | 2 +- .../python/grappler/tf_optimizer_test.py | 4 +- tensorflow/python/keras/backend_test.py | 2 +- tensorflow/python/keras/callbacks_test.py | 10 +- tensorflow/python/keras/engine/saving_test.py | 6 +- .../python/keras/engine/sequential_test.py | 2 +- .../python/keras/engine/topology_test.py | 3 +- .../python/keras/engine/training_test.py | 8 +- tensorflow/python/keras/integration_test.py | 9 +- tensorflow/python/keras/layers/lstm_test.py | 6 +- .../python/keras/layers/normalization_test.py | 3 +- .../python/keras/layers/simplernn_test.py | 4 +- .../python/keras/layers/unified_lstm_test.py | 4 +- .../python/keras/layers/wrappers_test.py | 10 +- .../python/keras/model_subclassing_test.py | 2 + tensorflow/python/keras/models_test.py | 13 +- tensorflow/python/keras/optimizers_test.py | 18 +-- .../kernel_tests/atrous_convolution_test.py | 3 + .../python/kernel_tests/base64_ops_test.py | 1 + .../kernel_tests/batch_matmul_op_test.py | 3 + .../boosted_trees/quantile_ops_test.py | 8 +- .../kernel_tests/checkpoint_ops_test.py | 1 + .../python/kernel_tests/cholesky_op_test.py | 2 + .../python/kernel_tests/cond_v2_test.py | 4 + .../conditional_accumulator_test.py | 12 +- .../kernel_tests/control_flow_ops_py_test.py | 118 +++++++++++++++--- .../kernel_tests/control_flow_util_test.py | 4 + .../python/kernel_tests/ctc_loss_op_test.py | 36 +++--- .../dense_update_ops_no_tsan_test.py | 8 +- .../kernel_tests/dense_update_ops_test.py | 6 +- .../kernel_tests/depthwise_conv_op_test.py | 4 + .../kernel_tests/determinant_op_test.py | 3 + .../distributions/multinomial_test.py | 17 +++ .../python/kernel_tests/fifo_queue_test.py | 4 + .../kernel_tests/functional_ops_test.py | 10 +- .../kernel_tests/identity_op_py_test.py | 2 +- .../linalg/linear_operator_test.py | 6 +- .../python/kernel_tests/linalg_grad_test.py | 2 + tensorflow/python/kernel_tests/losses_test.py | 52 ++++---- .../kernel_tests/matrix_band_part_op_test.py | 3 + .../kernel_tests/matrix_logarithm_op_test.py | 3 + .../kernel_tests/matrix_solve_ls_op_test.py | 5 +- .../matrix_square_root_op_test.py | 3 + .../python/kernel_tests/norm_op_test.py | 4 + .../python/kernel_tests/numerics_test.py | 6 +- .../kernel_tests/padding_fifo_queue_test.py | 3 + .../partitioned_variables_test.py | 8 +- .../kernel_tests/priority_queue_test.py | 7 ++ .../python/kernel_tests/py_func_test.py | 26 +++- tensorflow/python/kernel_tests/qr_op_test.py | 3 + .../random/random_shuffle_queue_test.py | 3 + .../resource_variable_ops_test.py | 10 +- tensorflow/python/kernel_tests/rnn_test.py | 2 +- .../kernel_tests/scatter_nd_ops_test.py | 11 +- .../kernel_tests/self_adjoint_eig_op_test.py | 3 + .../python/kernel_tests/session_ops_test.py | 5 + .../signal/reconstruction_ops_test.py | 3 + .../sparse_conditional_accumulator_test.py | 24 ++-- .../python/kernel_tests/stack_ops_test.py | 4 +- tensorflow/python/kernel_tests/svd_op_test.py | 5 + .../kernel_tests/tensor_array_ops_test.py | 32 ++--- .../python/kernel_tests/tensordot_op_test.py | 4 + .../kernel_tests/unicode_encode_op_test.py | 13 ++ .../python/kernel_tests/variables_test.py | 26 ++-- .../python/kernel_tests/while_v2_test.py | 4 +- .../python/layers/normalization_test.py | 37 +----- tensorflow/python/ops/gradients_test.py | 23 ++++ tensorflow/python/ops/nn_test.py | 1 + .../ops/ragged/ragged_batch_gather_op_test.py | 4 +- .../ops/ragged/ragged_boolean_mask_op_test.py | 2 +- .../ops/ragged/ragged_concat_op_test.py | 4 +- .../python/ops/ragged/ragged_dispatch_test.py | 2 +- .../ops/ragged/ragged_from_sparse_op_test.py | 8 +- .../ops/ragged/ragged_from_tensor_op_test.py | 6 +- .../ops/ragged/ragged_gather_nd_op_test.py | 4 +- .../ops/ragged/ragged_gather_op_test.py | 10 +- .../ops/ragged/ragged_map_fn_op_test.py | 6 +- .../ragged/ragged_map_inner_values_op_test.py | 18 +-- .../ops/ragged/ragged_operators_test.py | 4 +- .../ops/ragged/ragged_reduce_op_test.py | 2 +- .../ops/ragged/ragged_row_lengths_op_test.py | 2 +- .../ops/ragged/ragged_segment_op_test.py | 4 +- .../python/ops/ragged/ragged_stack_op_test.py | 2 +- .../ops/ragged/ragged_tensor_shape_test.py | 6 + .../python/ops/ragged/ragged_tensor_test.py | 12 +- .../ops/ragged/ragged_to_sparse_op_test.py | 4 +- .../python/ops/ragged/ragged_util_test.py | 2 + .../python/ops/ragged/ragged_where_op_test.py | 2 +- .../profiler/internal/run_metadata_test.py | 2 +- .../python/profiler/model_analyzer_test.py | 4 + .../python/profiler/pprof_profiler_test.py | 2 +- tensorflow/python/saved_model/loader_test.py | 10 +- tensorflow/python/saved_model/save_test.py | 2 +- .../python/saved_model/saved_model_test.py | 15 +-- .../saved_model/signature_def_utils_test.py | 2 + tensorflow/python/saved_model/utils_test.py | 8 ++ tensorflow/python/tools/freeze_graph_test.py | 4 +- tensorflow/python/training/adagrad_test.py | 4 +- .../training/basic_session_run_hooks_test.py | 4 +- .../python/training/checkpoint_ops_test.py | 2 + .../checkpointable/data_structures_test.py | 4 + .../training/checkpointable/util_test.py | 1 + tensorflow/python/training/input_test.py | 32 ++--- .../training/learning_rate_decay_test.py | 2 +- .../localhost_cluster_performance_test.py | 2 + .../python/training/monitored_session_test.py | 1 + .../python/training/moving_averages_test.py | 32 ++--- .../python/training/quantize_training_test.py | 2 +- .../python/training/queue_runner_test.py | 8 +- tensorflow/python/training/saver_test.py | 24 ++-- ...server_lib_same_variables_no_clear_test.py | 2 +- tensorflow/python/training/server_lib_test.py | 7 ++ .../python/training/session_manager_test.py | 30 ++--- .../python/training/slot_creator_test.py | 6 +- tensorflow/python/training/supervisor_test.py | 22 ++-- .../training/sync_replicas_optimizer_test.py | 5 + .../training/tensorboard_logging_test.py | 4 + .../python/training/training_ops_test.py | 14 +-- .../python/training/training_util_test.py | 4 +- .../tools/api/tests/api_compatibility_test.py | 4 +- .../compatibility/testdata/test_file_v0_11.py | 8 ++ .../compatibility/testdata/test_file_v1_12.py | 4 + 160 files changed, 827 insertions(+), 480 deletions(-) diff --git a/tensorflow/lite/experimental/microfrontend/python/kernel_tests/audio_microfrontend_op_test.py b/tensorflow/lite/experimental/microfrontend/python/kernel_tests/audio_microfrontend_op_test.py index 561f5f7a50e..3ce861707fd 100644 --- a/tensorflow/lite/experimental/microfrontend/python/kernel_tests/audio_microfrontend_op_test.py +++ b/tensorflow/lite/experimental/microfrontend/python/kernel_tests/audio_microfrontend_op_test.py @@ -21,6 +21,7 @@ from __future__ import print_function import tensorflow as tf from tensorflow.lite.experimental.microfrontend.python.ops import audio_microfrontend_op as frontend_op +from tensorflow.python.framework import test_util SAMPLE_RATE = 1000 WINDOW_SIZE = 25 @@ -33,6 +34,7 @@ SMOOTHING_BITS = 10 class AudioFeatureGenerationTest(tf.test.TestCase): + @test_util.run_v1_only("b/120545219") def testSimple(self): with self.test_session(): audio = tf.constant( @@ -51,6 +53,7 @@ class AudioFeatureGenerationTest(tf.test.TestCase): self.assertAllEqual(filterbanks.eval(), [[479, 425], [436, 378], [410, 350], [391, 325]]) + @test_util.run_v1_only("b/120545219") def testSimpleFloatScaled(self): with self.test_session(): audio = tf.constant( @@ -72,6 +75,7 @@ class AudioFeatureGenerationTest(tf.test.TestCase): [[7.484375, 6.640625], [6.8125, 5.90625], [6.40625, 5.46875], [6.109375, 5.078125]]) + @test_util.run_v1_only("b/120545219") def testStacking(self): with self.test_session(): audio = tf.constant( @@ -114,6 +118,7 @@ class AudioFeatureGenerationTest(tf.test.TestCase): [[479, 425, 479, 425, 436, 378], [479, 425, 436, 378, 410, 350], [436, 378, 410, 350, 391, 325], [410, 350, 391, 325, 391, 325]]) + @test_util.run_v1_only("b/120545219") def testStackingDropFrame(self): with self.test_session(): audio = tf.constant( diff --git a/tensorflow/lite/python/convert_saved_model_test.py b/tensorflow/lite/python/convert_saved_model_test.py index 76113853ca9..11bfcdc7954 100644 --- a/tensorflow/lite/python/convert_saved_model_test.py +++ b/tensorflow/lite/python/convert_saved_model_test.py @@ -39,6 +39,7 @@ from tensorflow.python.saved_model import tag_constants class TensorFunctionsTest(test_util.TensorFlowTestCase): + @test_util.run_v1_only("b/120545219") def testGetTensorsValid(self): in_tensor = array_ops.placeholder( shape=[1, 16, 16, 3], dtype=dtypes.float32) @@ -49,6 +50,7 @@ class TensorFunctionsTest(test_util.TensorFlowTestCase): sess.graph, ["Placeholder"]) self.assertEqual("Placeholder:0", tensors[0].name) + @test_util.run_v1_only("b/120545219") def testGetTensorsInvalid(self): in_tensor = array_ops.placeholder( shape=[1, 16, 16, 3], dtype=dtypes.float32) @@ -61,6 +63,7 @@ class TensorFunctionsTest(test_util.TensorFlowTestCase): self.assertEqual("Invalid tensors 'invalid-input' were found.", str(error.exception)) + @test_util.run_v1_only("b/120545219") def testSetTensorShapeValid(self): tensor = array_ops.placeholder(shape=[None, 3, 5], dtype=dtypes.float32) self.assertEqual([None, 3, 5], tensor.shape.as_list()) @@ -68,6 +71,7 @@ class TensorFunctionsTest(test_util.TensorFlowTestCase): convert_saved_model.set_tensor_shapes([tensor], {"Placeholder": [5, 3, 5]}) self.assertEqual([5, 3, 5], tensor.shape.as_list()) + @test_util.run_v1_only("b/120545219") def testSetTensorShapeNoneValid(self): tensor = array_ops.placeholder(dtype=dtypes.float32) self.assertEqual(None, tensor.shape) @@ -75,6 +79,7 @@ class TensorFunctionsTest(test_util.TensorFlowTestCase): convert_saved_model.set_tensor_shapes([tensor], {"Placeholder": [1, 3, 5]}) self.assertEqual([1, 3, 5], tensor.shape.as_list()) + @test_util.run_v1_only("b/120545219") def testSetTensorShapeArrayInvalid(self): # Tests set_tensor_shape where the tensor name passed in doesn't exist. tensor = array_ops.placeholder(shape=[None, 3, 5], dtype=dtypes.float32) @@ -88,6 +93,7 @@ class TensorFunctionsTest(test_util.TensorFlowTestCase): str(error.exception)) self.assertEqual([None, 3, 5], tensor.shape.as_list()) + @test_util.run_v1_only("b/120545219") def testSetTensorShapeDimensionInvalid(self): # Tests set_tensor_shape where the shape passed in is incompatiable. tensor = array_ops.placeholder(shape=[None, 3, 5], dtype=dtypes.float32) @@ -101,6 +107,7 @@ class TensorFunctionsTest(test_util.TensorFlowTestCase): "(?, 3, 5) to [1, 5, 5].", str(error.exception)) self.assertEqual([None, 3, 5], tensor.shape.as_list()) + @test_util.run_v1_only("b/120545219") def testSetTensorShapeEmpty(self): tensor = array_ops.placeholder(shape=[None, 3, 5], dtype=dtypes.float32) self.assertEqual([None, 3, 5], tensor.shape.as_list()) diff --git a/tensorflow/lite/python/convert_test.py b/tensorflow/lite/python/convert_test.py index 2a6f1f634f8..cf49ee2b472 100644 --- a/tensorflow/lite/python/convert_test.py +++ b/tensorflow/lite/python/convert_test.py @@ -34,6 +34,7 @@ from tensorflow.python.ops import math_ops from tensorflow.python.platform import test +@test_util.run_v1_only("b/120545219") class ConvertTest(test_util.TensorFlowTestCase): def testBasic(self): @@ -176,6 +177,7 @@ class ConvertTest(test_util.TensorFlowTestCase): "QUANTIZED_UINT8.", str(error.exception)) +@test_util.run_v1_only("b/120545219") class ConvertTestOpHint(test_util.TensorFlowTestCase): """Test the hint to stub functionality.""" diff --git a/tensorflow/lite/python/lite_test.py b/tensorflow/lite/python/lite_test.py index 2c630588caf..1f9c768b444 100644 --- a/tensorflow/lite/python/lite_test.py +++ b/tensorflow/lite/python/lite_test.py @@ -80,6 +80,7 @@ class FromConstructor(test_util.TensorFlowTestCase): self.assertTrue(converter._has_valid_tensors()) +@test_util.run_v1_only('b/120545219') class FromSessionTest(test_util.TensorFlowTestCase): def testFloat(self): @@ -497,6 +498,7 @@ class FromSessionTest(test_util.TensorFlowTestCase): interpreter.allocate_tensors() +@test_util.run_v1_only('b/120545219') class FromFrozenGraphFile(test_util.TensorFlowTestCase): def testFloat(self): @@ -744,6 +746,7 @@ class FromFrozenGraphFile(test_util.TensorFlowTestCase): interpreter.allocate_tensors() +@test_util.run_v1_only('b/120545219') class FromSavedModelTest(test_util.TensorFlowTestCase): def _createSavedModel(self, shape): @@ -888,6 +891,7 @@ class FromSavedModelTest(test_util.TensorFlowTestCase): interpreter.allocate_tensors() +@test_util.run_v1_only('b/120545219') class FromKerasFile(test_util.TensorFlowTestCase): def setUp(self): diff --git a/tensorflow/lite/testing/model_coverage/model_coverage_lib_test.py b/tensorflow/lite/testing/model_coverage/model_coverage_lib_test.py index 6b4e7427ed9..4e329ac97d7 100644 --- a/tensorflow/lite/testing/model_coverage/model_coverage_lib_test.py +++ b/tensorflow/lite/testing/model_coverage/model_coverage_lib_test.py @@ -28,6 +28,7 @@ from tensorflow.python import keras from tensorflow.python.client import session from tensorflow.python.framework import constant_op from tensorflow.python.framework import dtypes +from tensorflow.python.framework import test_util from tensorflow.python.ops import array_ops from tensorflow.python.ops import math_ops from tensorflow.python.platform import test @@ -42,6 +43,7 @@ class EvaluateFrozenGraph(test.TestCase): write_graph(sess.graph_def, '', graph_def_file, False) return graph_def_file + @test_util.run_v1_only('b/120545219') def testFloat(self): with session.Session().as_default() as sess: in_tensor = array_ops.placeholder( @@ -51,6 +53,7 @@ class EvaluateFrozenGraph(test.TestCase): model_coverage.test_frozen_graph(filename, ['Placeholder'], ['add']) + @test_util.run_v1_only('b/120545219') def testMultipleOutputs(self): with session.Session().as_default() as sess: in_tensor_1 = array_ops.placeholder( @@ -84,15 +87,18 @@ class EvaluateFrozenGraph(test.TestCase): filename = self._saveFrozenGraph(sess) return filename + @test_util.run_v1_only('b/120545219') def testQuantized(self): filename = self._getQuantizedModel() model_coverage.test_frozen_graph_quant(filename, ['inputA'], ['output']) + @test_util.run_v1_only('b/120545219') def testQuantizedInputShapes(self): filename = self._getQuantizedModel() model_coverage.test_frozen_graph_quant( filename, ['inputA'], ['output'], input_shapes={'inputA': [33, 33]}) + @test_util.run_v1_only('b/120545219') def testQuantizedFlexAll(self): filename = self._getQuantizedModel() model_coverage.test_frozen_graph_quant( @@ -102,6 +108,7 @@ class EvaluateFrozenGraph(test.TestCase): class EvaluateSavedModel(test.TestCase): + @test_util.run_v1_only('b/120545219') def testFloat(self): saved_model_dir = os.path.join(self.get_temp_dir(), 'simple_savedmodel') with session.Session().as_default() as sess: @@ -139,18 +146,21 @@ class EvaluateKerasModel(test.TestCase): os.close(fd) return keras_file + @test_util.run_v1_only('b/120545219') def testFloat(self): model = self._getSingleInputKerasModel() keras_file = self._saveKerasModel(model) model_coverage.test_keras_model(keras_file) + @test_util.run_v1_only('b/120545219') def testPostTrainingQuantize(self): model = self._getSingleInputKerasModel() keras_file = self._saveKerasModel(model) model_coverage.test_keras_model(keras_file, post_training_quantize=True) + @test_util.run_v1_only('b/120545219') def testTargetOps(self): model = self._getSingleInputKerasModel() keras_file = self._saveKerasModel(model) diff --git a/tensorflow/python/autograph/impl/api_test.py b/tensorflow/python/autograph/impl/api_test.py index 66edda51193..d5561ba8249 100644 --- a/tensorflow/python/autograph/impl/api_test.py +++ b/tensorflow/python/autograph/impl/api_test.py @@ -218,6 +218,7 @@ class ApiTest(test.TestCase): constant_op.constant(-1)) self.assertEqual(1, self.evaluate(x)) + @test_util.run_v1_only('b/120545219') def test_converted_call_functools_partial(self): def test_fn(x, y, z): diff --git a/tensorflow/python/client/session_test.py b/tensorflow/python/client/session_test.py index 347833ce8fd..c4a118a4140 100644 --- a/tensorflow/python/client/session_test.py +++ b/tensorflow/python/client/session_test.py @@ -312,6 +312,7 @@ class SessionTest(test_util.TensorFlowTestCase): self.assertEqual(None, res[2]) self.assertEqual(44.0, res[1]) + @test_util.run_v1_only('b/120545219') def testFetchAttrs(self): if attr is None: self.skipTest('attr module is unavailable.') @@ -340,6 +341,7 @@ class SessionTest(test_util.TensorFlowTestCase): self.assertAllEqual(val3, result.field1) self.assertAllEqual(val2, result.field2) + @test_util.run_v1_only('b/120545219') def testFetchNestedAttrs(self): if attr is None: self.skipTest('attr module is unavailable.') @@ -1024,6 +1026,7 @@ class SessionTest(test_util.TensorFlowTestCase): fed_c_val = c.eval(feed_dict={a.name: [[4.0, 4.0]]}) self.assertAllEqual([[16.0, 16.0, 16.0]], fed_c_val) + @test_util.run_v1_only('b/120545219') def testOperationRunMethod(self): with session.Session(): a = constant_op.constant(1.0, shape=[1, 2]) @@ -1154,6 +1157,7 @@ class SessionTest(test_util.TensorFlowTestCase): else: importer.import_graph_def(gdef, name='import') + @test_util.run_v1_only('b/120545219') def testParallelRunAndSingleBuild(self): with session.Session() as sess: c = constant_op.constant(5.0) @@ -1174,6 +1178,7 @@ class SessionTest(test_util.TensorFlowTestCase): for t in threads: t.join() + @test_util.run_v1_only('b/120545219') def testParallelRunAndParallelBuild(self): with session.Session() as sess: c = constant_op.constant(5.0) @@ -1274,6 +1279,7 @@ class SessionTest(test_util.TensorFlowTestCase): with self.assertRaisesRegexp(RuntimeError, 'The Session graph is empty.'): sess.run({}) + @test_util.run_v1_only('b/120545219') def testNotEntered(self): # pylint: disable=protected-access self.assertEqual(ops._default_session_stack.get_default(), None) @@ -1289,6 +1295,7 @@ class SessionTest(test_util.TensorFlowTestCase): ValueError, lambda e: 'No default session is registered.' in str(e)): c_2.eval() + @test_util.run_v1_only('b/120545219') def testInteractive(self): with ops.device('/cpu:0'): sess = session.InteractiveSession() @@ -1301,6 +1308,7 @@ class SessionTest(test_util.TensorFlowTestCase): self.assertAllEqual([[24.0]], e.eval()) sess.close() + @test_util.run_v1_only('b/120545219') def testMultipleInteractiveSessionsWarning(self): # Reinitialize the global state to ensure that the expected warnings will # be emitted. @@ -1328,6 +1336,7 @@ class SessionTest(test_util.TensorFlowTestCase): sess2.close() sess.close() + @test_util.run_v1_only('b/120545219') def testInteractivePlacePrunedGraph(self): sess = session.InteractiveSession() @@ -1349,6 +1358,7 @@ class SessionTest(test_util.TensorFlowTestCase): a.eval() sess.close() + @test_util.run_v1_only('b/120545219') def testDefaultSessionPlacePrunedGraph(self): sess = session.Session() @@ -1769,9 +1779,11 @@ class SessionTest(test_util.TensorFlowTestCase): sess.run(a, run_metadata=run_metadata) self.assertEqual(len(run_metadata.partition_graphs), 0) + @test_util.run_v1_only('b/120545219') def testOutputPartitionGraphsDirect(self): self.runTestOutputPartitionGraphs(session.Session()) + @test_util.run_v1_only('b/120545219') def testOutputPartitionGraphsDistributed(self): server = server_lib.Server.create_local_server() self.runTestOutputPartitionGraphs(session.Session(server.target)) @@ -1796,6 +1808,7 @@ class SessionTest(test_util.TensorFlowTestCase): del sess1 del sess2 + @test_util.run_v1_only('b/120545219') def testAsDefault(self): c = constant_op.constant(37) sess = session.Session() @@ -1821,6 +1834,7 @@ class SessionTest(test_util.TensorFlowTestCase): with self.assertRaisesRegexp(TypeError, 'graph must be a tf.Graph'): session.Session(graph=37) + @test_util.run_v1_only('b/120545219') def testTimeoutWithShortOperations(self): num_epochs = 5 q = data_flow_ops.FIFOQueue(capacity=50, dtypes=[dtypes.int32], shapes=[()]) @@ -1834,6 +1848,7 @@ class SessionTest(test_util.TensorFlowTestCase): sess.run(enqueue_op) self.assertEqual(sess.run(q.size()), num_epochs * 2) + @test_util.run_v1_only('b/120545219') def testRegisterFetchAndFeedConversionFunctions(self): class SquaredTensor(object): @@ -1865,6 +1880,7 @@ class SessionTest(test_util.TensorFlowTestCase): squared_eval = sess.partial_run(partial_run, squared_tensor) self.assertAllClose(np2 * np2, squared_eval) + @test_util.run_v1_only('b/120545219') def testDefaultLogDevicePlacement(self): class CaptureStderr(str): @@ -1914,6 +1930,7 @@ class SessionTest(test_util.TensorFlowTestCase): self.assertTrue('/job:local/replica:0/task:0/device:CPU:0' in str(log), str(log)) + @test_util.run_v1_only('b/120545219') def testLocalMasterSessionTimeout(self): # Test that the timeout passed in a config to the session works correctly. config = config_pb2.ConfigProto(operation_timeout_in_ms=1000) @@ -1927,6 +1944,7 @@ class SessionTest(test_util.TensorFlowTestCase): with self.assertRaises(errors.DeadlineExceededError): sess.run(dequeued_t) + @test_util.run_v1_only('b/120545219') def testDefaultServerTimeout(self): # Test that the default server config timeout gets used when no Session # config is provided. @@ -1952,9 +1970,11 @@ class SessionTest(test_util.TensorFlowTestCase): with self.assertRaisesOpError('has inputs from different frames'): sess.run(res, feed_dict={data: 1.0}) + @test_util.run_v1_only('b/120545219') def testBuildGraphErrorDirect(self): self.runTestBuildGraphError(session.Session()) + @test_util.run_v1_only('b/120545219') def testBuildGraphErrorDist(self): server = server_lib.Server.create_local_server() self.runTestBuildGraphError(session.Session(server.target)) @@ -1993,9 +2013,11 @@ class SessionTest(test_util.TensorFlowTestCase): result = sess.run(f) self.assertEqual(result, 2.0) + @test_util.run_v1_only('b/120545219') def testAddFunctionToSession(self): self.runTestAddFunctionToSession() + @test_util.run_v1_only('b/120545219') def testAddFunctionToGrpcSession(self): server = server_lib.Server.create_local_server() self.runTestAddFunctionToSession(server.target) @@ -2009,6 +2031,7 @@ class SessionTest(test_util.TensorFlowTestCase): with session.Session(): pass + @test_util.run_v1_only('b/120545219') def testAutoConvertAndCheckData(self): with self.cached_session() as sess: a = array_ops.placeholder(dtype=dtypes.string) diff --git a/tensorflow/python/data/kernel_tests/interleave_test.py b/tensorflow/python/data/kernel_tests/interleave_test.py index c3450e65251..05a211afcc1 100644 --- a/tensorflow/python/data/kernel_tests/interleave_test.py +++ b/tensorflow/python/data/kernel_tests/interleave_test.py @@ -264,6 +264,7 @@ class InterleaveTest(test_base.DatasetTestBase, parameterized.TestCase): ("8", np.int64([4, 0, 6]), 2, 3, 1), ("9", np.int64([4, 0, 6]), 2, 3, 2), ) + @test_util.run_v1_only("b/120545219") def testSkipEagerSloppyInterleaveInOrder(self, input_values, cycle_length, block_length, num_parallel_calls): get_next, coordination_events = _make_coordinated_sloppy_dataset( @@ -286,6 +287,7 @@ class InterleaveTest(test_base.DatasetTestBase, parameterized.TestCase): ("3", np.int64([4, 5, 6]), 3, 2, 3), ("4", np.int64([4, 0, 6]), 2, 3, 2), ) + @test_util.run_v1_only("b/120545219") def testSkipEagerSloppyInterleaveOutOfOrder(self, input_values, cycle_length, block_length, num_parallel_calls): get_next, coordination_events = _make_coordinated_sloppy_dataset( diff --git a/tensorflow/python/data/kernel_tests/iterator_cluster_test.py b/tensorflow/python/data/kernel_tests/iterator_cluster_test.py index 728bed20a12..20088234953 100644 --- a/tensorflow/python/data/kernel_tests/iterator_cluster_test.py +++ b/tensorflow/python/data/kernel_tests/iterator_cluster_test.py @@ -39,6 +39,7 @@ from tensorflow.python.platform import test class IteratorClusterTest(test.TestCase): + @test_util.run_v1_only("b/120545219") def testRemoteIteratorWithoutRemoteCallFail(self): worker_config = config_pb2.ConfigProto() worker_config.device_count["CPU"] = 2 @@ -92,6 +93,7 @@ class IteratorClusterTest(test.TestCase): with self.assertRaises(errors.OutOfRangeError): sess.run(remote_op, feed_dict={target_placeholder: device1}) + @test_util.run_v1_only("b/120545219") def testRemoteIteratorUsingRemoteCallOp(self): worker_config = config_pb2.ConfigProto() worker_config.device_count["CPU"] = 2 @@ -102,6 +104,7 @@ class IteratorClusterTest(test.TestCase): "/job:worker/replica:0/task:0/cpu:1", worker[0].target) + @test_util.run_v1_only("b/120545219") def testRemoteIteratorUsingRemoteCallOpCrossProcess(self): workers, _ = test_util.create_local_cluster(2, 1) @@ -109,6 +112,7 @@ class IteratorClusterTest(test.TestCase): "/job:worker/replica:0/task:1/cpu:0", workers[0].target) + @test_util.run_v1_only("b/120545219") def testCaptureHashTableInSharedIterator(self): worker, _ = test_util.create_local_cluster(1, 1) @@ -143,6 +147,7 @@ class IteratorClusterTest(test.TestCase): with self.assertRaises(errors.OutOfRangeError): sess.run(get_next) + @test_util.run_v1_only("b/120545219") def testImplicitDisposeParallelMapDataset(self): # Tests whether a parallel map dataset will be cleaned up correctly when # the pipeline does not run it until exhaustion. diff --git a/tensorflow/python/data/kernel_tests/map_test.py b/tensorflow/python/data/kernel_tests/map_test.py index 8b22542e114..e07706413de 100644 --- a/tensorflow/python/data/kernel_tests/map_test.py +++ b/tensorflow/python/data/kernel_tests/map_test.py @@ -34,6 +34,7 @@ from tensorflow.python.framework import errors from tensorflow.python.framework import ops from tensorflow.python.framework import sparse_tensor from tensorflow.python.framework import tensor_util +from tensorflow.python.framework import test_util from tensorflow.python.ops import array_ops from tensorflow.python.ops import control_flow_ops from tensorflow.python.ops import data_flow_ops @@ -82,6 +83,7 @@ def _make_coordinated_sloppy_dataset(num_elements, num_parallel_calls): return next_element, coordination_events +@test_util.run_v1_only("b/120545219") class MapDatasetTest(test_base.DatasetTestBase, parameterized.TestCase): def _buildMapDataset(self, components, count): diff --git a/tensorflow/python/data/kernel_tests/multi_device_iterator_test.py b/tensorflow/python/data/kernel_tests/multi_device_iterator_test.py index 622ebb55dec..0322d1f2c60 100644 --- a/tensorflow/python/data/kernel_tests/multi_device_iterator_test.py +++ b/tensorflow/python/data/kernel_tests/multi_device_iterator_test.py @@ -35,6 +35,7 @@ from tensorflow.python.platform import test # TODO(b/117581999): Add eager coverage. class MultiDeviceIteratorTest(test_base.DatasetTestBase): + @test_util.run_v1_only("b/120545219") def testNoGetNext(self): dataset = dataset_ops.Dataset.range(10) multi_device_iterator = multi_device_iterator_ops.MultiDeviceIterator( @@ -44,6 +45,7 @@ class MultiDeviceIteratorTest(test_base.DatasetTestBase): with self.test_session(config=config) as sess: self.evaluate(multi_device_iterator.initializer) + @test_util.run_v1_only("b/120545219") def testBasic(self): dataset = dataset_ops.Dataset.range(10) multi_device_iterator = multi_device_iterator_ops.MultiDeviceIterator( @@ -60,6 +62,7 @@ class MultiDeviceIteratorTest(test_base.DatasetTestBase): self.evaluate(elem_on_1) self.evaluate(elem_on_2) + @test_util.run_v1_only("b/120545219") def testOneOnSameDevice(self): with ops.device("/cpu:0"): dataset = dataset_ops.Dataset.range(10) @@ -77,6 +80,7 @@ class MultiDeviceIteratorTest(test_base.DatasetTestBase): self.evaluate(elem_on_1) self.evaluate(elem_on_2) + @test_util.run_v1_only("b/120545219") def testRepeatDevices(self): with ops.device("/cpu:0"): dataset = dataset_ops.Dataset.range(20) @@ -99,6 +103,7 @@ class MultiDeviceIteratorTest(test_base.DatasetTestBase): self.evaluate(elem_on_3) self.evaluate(elem_on_4) + @test_util.run_v1_only("b/120545219") def testNotFullyDivisible(self): dataset = dataset_ops.Dataset.range(9) multi_device_iterator = multi_device_iterator_ops.MultiDeviceIterator( @@ -116,6 +121,7 @@ class MultiDeviceIteratorTest(test_base.DatasetTestBase): self.evaluate(elem_on_1) self.evaluate(elem_on_2) + @test_util.run_v1_only("b/120545219") def testGetNextAsOptional(self): dataset = dataset_ops.Dataset.range(9) multi_device_iterator = multi_device_iterator_ops.MultiDeviceIterator( @@ -149,6 +155,7 @@ class MultiDeviceIteratorTest(test_base.DatasetTestBase): with self.assertRaises(errors.InvalidArgumentError): self.evaluate(elem_on_2_t) + @test_util.run_v1_only("b/120545219") def testUneven(self): dataset = dataset_ops.Dataset.range(10) multi_device_iterator = multi_device_iterator_ops.MultiDeviceIterator( @@ -166,6 +173,7 @@ class MultiDeviceIteratorTest(test_base.DatasetTestBase): self.evaluate(elem_on_1) self.evaluate(elem_on_2) + @test_util.run_v1_only("b/120545219") def testMultipleInitializations(self): with ops.device("/cpu:0"): epoch = array_ops.placeholder(dtypes.int64, shape=[]) @@ -259,6 +267,7 @@ class MultiDeviceIteratorTest(test_base.DatasetTestBase): with self.assertRaises(errors.InvalidArgumentError): self.evaluate(elem_on_2_t) + @test_util.run_v1_only("b/120545219") def testOptimization(self): dataset = dataset_ops.Dataset.range(10) dataset = dataset.apply(optimization.assert_next(["MemoryCacheImpl"])) diff --git a/tensorflow/python/debug/cli/analyzer_cli_test.py b/tensorflow/python/debug/cli/analyzer_cli_test.py index 322ecf94667..586982dc4bf 100644 --- a/tensorflow/python/debug/cli/analyzer_cli_test.py +++ b/tensorflow/python/debug/cli/analyzer_cli_test.py @@ -573,6 +573,7 @@ def create_analyzer_cli(dump): return analyzer, registry +@test_util.run_v1_only("b/120545219") class AnalyzerCLISimpleMulAddTest(test_util.TensorFlowTestCase): @classmethod @@ -645,7 +646,6 @@ class AnalyzerCLISimpleMulAddTest(test_util.TensorFlowTestCase): self.assertEqual(len("Size (B)") + 1, dump_size_col_width) self.assertEqual(len("Op type") + 1, op_type_col_width) - @test_util.run_deprecated_v1 def testMeasureTensorListColumnWidthsGivesRightAnswerForData(self): dump = self._debug_dump.dumped_tensor_data[0] self.assertLess(dump.dump_size_bytes, 1000) @@ -661,7 +661,6 @@ class AnalyzerCLISimpleMulAddTest(test_util.TensorFlowTestCase): # column should be determined by the length of "VariableV2". self.assertEqual(len("VariableV2") + 1, op_type_col_width) - @test_util.run_deprecated_v1 def testListTensors(self): # Use shorthand alias for the command prefix. out = self._registry.dispatch_command("lt", []) @@ -675,7 +674,6 @@ class AnalyzerCLISimpleMulAddTest(test_util.TensorFlowTestCase): # Check the main menu. check_main_menu(self, out, list_tensors_enabled=False) - @test_util.run_deprecated_v1 def testListTensorsInReverseTimeOrderWorks(self): # Use shorthand alias for the command prefix. out = self._registry.dispatch_command("lt", ["-s", "timestamp", "-r"]) @@ -691,7 +689,6 @@ class AnalyzerCLISimpleMulAddTest(test_util.TensorFlowTestCase): reverse=True) check_main_menu(self, out, list_tensors_enabled=False) - @test_util.run_deprecated_v1 def testListTensorsInDumpSizeOrderWorks(self): out = self._registry.dispatch_command("lt", ["-s", "dump_size"]) assert_listed_tensors( @@ -705,7 +702,6 @@ class AnalyzerCLISimpleMulAddTest(test_util.TensorFlowTestCase): sort_by="dump_size") check_main_menu(self, out, list_tensors_enabled=False) - @test_util.run_deprecated_v1 def testListTensorsInReverseDumpSizeOrderWorks(self): out = self._registry.dispatch_command("lt", ["-s", "dump_size", "-r"]) assert_listed_tensors( @@ -725,7 +721,6 @@ class AnalyzerCLISimpleMulAddTest(test_util.TensorFlowTestCase): self.assertIn("ValueError: Unsupported key to sort tensors by: foobar", out.lines) - @test_util.run_deprecated_v1 def testListTensorsInOpTypeOrderWorks(self): # Use shorthand alias for the command prefix. out = self._registry.dispatch_command("lt", ["-s", "op_type"]) @@ -741,7 +736,6 @@ class AnalyzerCLISimpleMulAddTest(test_util.TensorFlowTestCase): reverse=False) check_main_menu(self, out, list_tensors_enabled=False) - @test_util.run_deprecated_v1 def testListTensorsInReverseOpTypeOrderWorks(self): # Use shorthand alias for the command prefix. out = self._registry.dispatch_command("lt", ["-s", "op_type", "-r"]) @@ -757,7 +751,6 @@ class AnalyzerCLISimpleMulAddTest(test_util.TensorFlowTestCase): reverse=True) check_main_menu(self, out, list_tensors_enabled=False) - @test_util.run_deprecated_v1 def testListTensorsInTensorNameOrderWorks(self): # Use shorthand alias for the command prefix. out = self._registry.dispatch_command("lt", ["-s", "tensor_name"]) @@ -773,7 +766,6 @@ class AnalyzerCLISimpleMulAddTest(test_util.TensorFlowTestCase): reverse=False) check_main_menu(self, out, list_tensors_enabled=False) - @test_util.run_deprecated_v1 def testListTensorsInReverseTensorNameOrderWorks(self): # Use shorthand alias for the command prefix. out = self._registry.dispatch_command("lt", ["-s", "tensor_name", "-r"]) @@ -789,7 +781,6 @@ class AnalyzerCLISimpleMulAddTest(test_util.TensorFlowTestCase): reverse=True) check_main_menu(self, out, list_tensors_enabled=False) - @test_util.run_deprecated_v1 def testListTensorsFilterByNodeNameRegex(self): out = self._registry.dispatch_command("list_tensors", ["--node_name_filter", ".*read.*"]) @@ -803,7 +794,6 @@ class AnalyzerCLISimpleMulAddTest(test_util.TensorFlowTestCase): assert_listed_tensors(self, out, [], [], node_name_regex="^read") check_main_menu(self, out, list_tensors_enabled=False) - @test_util.run_deprecated_v1 def testListTensorFilterByOpTypeRegex(self): out = self._registry.dispatch_command("list_tensors", ["--op_type_filter", "Identity"]) @@ -832,7 +822,6 @@ class AnalyzerCLISimpleMulAddTest(test_util.TensorFlowTestCase): op_type_regex="(Add|MatMul)") check_main_menu(self, out, list_tensors_enabled=False) - @test_util.run_deprecated_v1 def testListTensorWithFilterAndNodeNameExclusionWorks(self): # First, create and register the filter. def is_2x1_vector(datum, tensor): @@ -889,7 +878,6 @@ class AnalyzerCLISimpleMulAddTest(test_util.TensorFlowTestCase): out = self._registry.dispatch_command("list_tensors", ["--bar"]) check_syntax_error_output(self, out, "list_tensors") - @test_util.run_deprecated_v1 def testNodeInfoByNodeName(self): node_name = "simple_mul_add/matmul" out = self._registry.dispatch_command("node_info", [node_name]) @@ -914,7 +902,6 @@ class AnalyzerCLISimpleMulAddTest(test_util.TensorFlowTestCase): [(len(out.lines[0]) - len(node_name), len(out.lines[0]), "bold")], out.font_attr_segs[0]) - @test_util.run_deprecated_v1 def testNodeInfoShowAttributes(self): node_name = "simple_mul_add/matmul" out = self._registry.dispatch_command("node_info", ["-a", node_name]) @@ -938,7 +925,6 @@ class AnalyzerCLISimpleMulAddTest(test_util.TensorFlowTestCase): print_tensor_node_name=node_name, list_outputs_node_name=node_name) - @test_util.run_deprecated_v1 def testNodeInfoShowDumps(self): node_name = "simple_mul_add/matmul" out = self._registry.dispatch_command("node_info", ["-d", node_name]) @@ -963,7 +949,6 @@ class AnalyzerCLISimpleMulAddTest(test_util.TensorFlowTestCase): len(out.lines[16]) - len(out.lines[16].strip()), len(out.lines[16]), "pt %s:0 -n 0" % node_name) - @test_util.run_deprecated_v1 def testNodeInfoShowStackTraceUnavailableIsIndicated(self): self._debug_dump.set_python_graph(None) @@ -987,7 +972,6 @@ class AnalyzerCLISimpleMulAddTest(test_util.TensorFlowTestCase): print_tensor_node_name=node_name, list_outputs_node_name=node_name) - @test_util.run_deprecated_v1 def testNodeInfoShowStackTraceAvailableWorks(self): self._debug_dump.set_python_graph(self._sess.graph) @@ -1011,7 +995,6 @@ class AnalyzerCLISimpleMulAddTest(test_util.TensorFlowTestCase): print_tensor_node_name=node_name, list_outputs_node_name=node_name) - @test_util.run_deprecated_v1 def testNodeInfoByTensorName(self): node_name = "simple_mul_add/u/read" tensor_name = node_name + ":0" @@ -1381,7 +1364,6 @@ class AnalyzerCLISimpleMulAddTest(test_util.TensorFlowTestCase): break return index - @test_util.run_deprecated_v1 def testPrintSourceForOpNamesWholeFileWorks(self): self._debug_dump.set_python_graph(self._sess.graph) out = self._registry.dispatch_command( @@ -1434,7 +1416,6 @@ class AnalyzerCLISimpleMulAddTest(test_util.TensorFlowTestCase): self.assertEqual("pt simple_mul_add/add", out.font_attr_segs[index + 1][0][2].content) - @test_util.run_deprecated_v1 def testPrintSourceForTensorNamesWholeFileWorks(self): self._debug_dump.set_python_graph(self._sess.graph) out = self._registry.dispatch_command( @@ -1455,7 +1436,6 @@ class AnalyzerCLISimpleMulAddTest(test_util.TensorFlowTestCase): self.assertEqual("pt simple_mul_add/u:0", out.font_attr_segs[index + 2][0][2].content) - @test_util.run_deprecated_v1 def testPrintSourceForOpNamesStartingAtSpecifiedLineWorks(self): self._debug_dump.set_python_graph(self._sess.graph) out = self._registry.dispatch_command( @@ -1482,7 +1462,6 @@ class AnalyzerCLISimpleMulAddTest(test_util.TensorFlowTestCase): self.assertEqual("pt simple_mul_add/u/read", out.font_attr_segs[index + 3][0][2].content) - @test_util.run_deprecated_v1 def testPrintSourceForOpNameSettingMaximumElementCountWorks(self): self._debug_dump.set_python_graph(self._sess.graph) out = self._registry.dispatch_command( @@ -1527,7 +1506,6 @@ class AnalyzerCLISimpleMulAddTest(test_util.TensorFlowTestCase): self.assertTrue(cli_shared.COLOR_GRAY in attr_seg[2] or attr_seg[2] == cli_shared.COLOR_GRAY) - @test_util.run_deprecated_v1 def testListSourceWithNodeNameFilterWithMatchesWorks(self): self._debug_dump.set_python_graph(self._sess.graph) out = self._registry.dispatch_command("list_source", ["-n", ".*/read"]) @@ -1691,6 +1669,7 @@ class AnalyzerCLIPrintLargeTensorTest(test_util.TensorFlowTestCase): self.assertNotIn("...,", out.lines[4]) +@test_util.run_v1_only("b/120545219") class AnalyzerCLIControlDepTest(test_util.TensorFlowTestCase): @classmethod @@ -1742,7 +1721,6 @@ class AnalyzerCLIControlDepTest(test_util.TensorFlowTestCase): # Tear down temporary dump directory. shutil.rmtree(cls._dump_root) - @test_util.run_deprecated_v1 def testNodeInfoWithControlDependencies(self): # Call node_info on a node with control inputs. out = self._registry.dispatch_command("node_info", @@ -1783,7 +1761,6 @@ class AnalyzerCLIControlDepTest(test_util.TensorFlowTestCase): len(out.lines[z_line]), "ni -a -d -t control_deps/ctrl_dep_z") - @test_util.run_deprecated_v1 def testListInputsNonRecursiveNoControl(self): """List inputs non-recursively, without any control inputs.""" @@ -1826,7 +1803,6 @@ class AnalyzerCLIControlDepTest(test_util.TensorFlowTestCase): len(out.lines[3]) - len("control_deps/ctrl_dep_y"), len(out.lines[3]), "li -c -r control_deps/ctrl_dep_y") - @test_util.run_deprecated_v1 def testListInputsNonRecursiveNoControlUsingTensorName(self): """List inputs using the name of an output tensor of the node.""" @@ -1855,7 +1831,6 @@ class AnalyzerCLIControlDepTest(test_util.TensorFlowTestCase): len(out.lines[3]) - len("control_deps/ctrl_dep_y"), len(out.lines[3]), "li -c -r control_deps/ctrl_dep_y") - @test_util.run_deprecated_v1 def testListInputsNonRecursiveWithControls(self): """List inputs non-recursively, with control inputs.""" node_name = "control_deps/ctrl_dep_z" @@ -1886,7 +1861,6 @@ class AnalyzerCLIControlDepTest(test_util.TensorFlowTestCase): len(out.lines[5]) - len("control_deps/x"), len(out.lines[5]), "li -c -r control_deps/x") - @test_util.run_deprecated_v1 def testListInputsRecursiveWithControls(self): """List inputs recursively, with control inputs.""" node_name = "control_deps/ctrl_dep_z" @@ -1932,7 +1906,6 @@ class AnalyzerCLIControlDepTest(test_util.TensorFlowTestCase): len(out.lines[18]) - len("control_deps/x"), len(out.lines[18]), "li -c -r control_deps/x") - @test_util.run_deprecated_v1 def testListInputsRecursiveWithControlsWithDepthLimit(self): """List inputs recursively, with control inputs and a depth limit.""" node_name = "control_deps/ctrl_dep_z" @@ -1992,7 +1965,6 @@ class AnalyzerCLIControlDepTest(test_util.TensorFlowTestCase): "ERROR: There is no node named \"control_deps/z/foo\" in the " "partition graphs"], out.lines) - @test_util.run_deprecated_v1 def testListRecipientsRecursiveWithControlsWithDepthLimit(self): """List recipients recursively, with control inputs and a depth limit.""" @@ -2025,6 +1997,7 @@ class AnalyzerCLIControlDepTest(test_util.TensorFlowTestCase): out.font_attr_segs[0]) +@test_util.run_v1_only("b/120545219") class AnalyzerCLIWhileLoopTest(test_util.TensorFlowTestCase): @classmethod @@ -2064,7 +2037,6 @@ class AnalyzerCLIWhileLoopTest(test_util.TensorFlowTestCase): # Tear down temporary dump directory. shutil.rmtree(cls._dump_root) - @test_util.run_deprecated_v1 def testMultipleDumpsPrintTensorNoNumber(self): output = self._registry.dispatch_command("pt", ["while/Identity:0"]) @@ -2082,7 +2054,6 @@ class AnalyzerCLIWhileLoopTest(test_util.TensorFlowTestCase): self.assertEqual("For example:", output.lines[-2]) self.assertEqual(" print_tensor while/Identity:0 -n 0", output.lines[-1]) - @test_util.run_deprecated_v1 def testMultipleDumpsPrintTensorWithNumber(self): for i in xrange(5): output = self._registry.dispatch_command( @@ -2096,7 +2067,6 @@ class AnalyzerCLIWhileLoopTest(test_util.TensorFlowTestCase): self.assertTrue(output.lines[4].startswith("array(%d" % i)) self.assertTrue(output.lines[4].endswith(")")) - @test_util.run_deprecated_v1 def testMultipleDumpsPrintTensorInvalidNumber(self): output = self._registry.dispatch_command("pt", ["while/Identity:0", "-n", "10"]) diff --git a/tensorflow/python/debug/cli/cli_shared_test.py b/tensorflow/python/debug/cli/cli_shared_test.py index d191a234fde..66a12efda53 100644 --- a/tensorflow/python/debug/cli/cli_shared_test.py +++ b/tensorflow/python/debug/cli/cli_shared_test.py @@ -105,6 +105,7 @@ class TimeToReadableStrTest(test_util.TensorFlowTestCase): cli_shared.time_to_readable_str(100, force_time_unit="ks") +@test_util.run_v1_only("b/120545219") class GetRunStartIntroAndDescriptionTest(test_util.TensorFlowTestCase): def setUp(self): @@ -334,6 +335,7 @@ class GetRunStartIntroAndDescriptionTest(test_util.TensorFlowTestCase): self.assertEqual("run #1: 1 fetch (a:0); 1 feed (foo)", short_description) +@test_util.run_v1_only("b/120545219") class GetErrorIntroTest(test_util.TensorFlowTestCase): def setUp(self): @@ -342,7 +344,6 @@ class GetErrorIntroTest(test_util.TensorFlowTestCase): def tearDown(self): ops.reset_default_graph() - @test_util.run_deprecated_v1 def testShapeError(self): tf_error = errors.OpError(None, self.var_a.initializer, "foo description", None) diff --git a/tensorflow/python/debug/cli/profile_analyzer_cli_test.py b/tensorflow/python/debug/cli/profile_analyzer_cli_test.py index effcd500c70..d6d2b58b5f8 100644 --- a/tensorflow/python/debug/cli/profile_analyzer_cli_test.py +++ b/tensorflow/python/debug/cli/profile_analyzer_cli_test.py @@ -70,6 +70,7 @@ def _assert_no_lines_match(pattern, lines): "%s matched at least one line in %s." % (pattern, str(lines))) +@test_util.run_v1_only("b/120545219") class ProfileAnalyzerListProfileTest(test_util.TensorFlowTestCase): def testNodeInfoEmpty(self): @@ -321,6 +322,7 @@ class ProfileAnalyzerListProfileTest(test_util.TensorFlowTestCase): _assert_at_least_one_line_matches(r"Device Total.*0\.009ms", prof_output) +@test_util.run_v1_only("b/120545219") class ProfileAnalyzerPrintSourceTest(test_util.TensorFlowTestCase): def setUp(self): @@ -348,7 +350,6 @@ class ProfileAnalyzerPrintSourceTest(test_util.TensorFlowTestCase): ops.reset_default_graph() super(ProfileAnalyzerPrintSourceTest, self).tearDown() - @test_util.run_deprecated_v1 def testPrintSourceForWhileLoop(self): prof_output = self.prof_analyzer.print_source([__file__]) @@ -362,7 +363,6 @@ class ProfileAnalyzerPrintSourceTest(test_util.TensorFlowTestCase): r"\[(\|)+(\s)*\] .*us .*7\(55\) .*L%d.*(\S)+" % self.loop_lineno, prof_output.lines) - @test_util.run_deprecated_v1 def testPrintSourceOutputContainsClickableLinks(self): prof_output = self.prof_analyzer.print_source([__file__]) any_match, line_index = _at_least_one_line_matches( @@ -379,7 +379,6 @@ class ProfileAnalyzerPrintSourceTest(test_util.TensorFlowTestCase): break self.assertTrue(any_menu_item_match) - @test_util.run_deprecated_v1 def testPrintSourceWithNonDefaultTimeUnit(self): prof_output = self.prof_analyzer.print_source([ __file__, "--time_unit", "ms"]) @@ -394,7 +393,6 @@ class ProfileAnalyzerPrintSourceTest(test_util.TensorFlowTestCase): r"\[(\|)+(\s)*\] .*ms .*7\(55\) .*L%d.*(\S)+" % self.loop_lineno, prof_output.lines) - @test_util.run_deprecated_v1 def testPrintSourceWithNodeNameFilter(self): prof_output = self.prof_analyzer.print_source([ __file__, "--node_name_filter", "x$"]) @@ -427,7 +425,6 @@ class ProfileAnalyzerPrintSourceTest(test_util.TensorFlowTestCase): break self.assertTrue(any_menu_item_match) - @test_util.run_deprecated_v1 def testPrintSourceWithOpTypeFilter(self): prof_output = self.prof_analyzer.print_source([ __file__, "--op_type_filter", "Less"]) diff --git a/tensorflow/python/debug/cli/stepper_cli_test.py b/tensorflow/python/debug/cli/stepper_cli_test.py index 7b8a42c2538..5cf69d0168b 100644 --- a/tensorflow/python/debug/cli/stepper_cli_test.py +++ b/tensorflow/python/debug/cli/stepper_cli_test.py @@ -129,6 +129,7 @@ def _parse_updated(lines): return updated +@test_util.run_v1_only("b/120545219") class NodeStepperSimpleGraphTest(test_util.TensorFlowTestCase): def setUp(self): diff --git a/tensorflow/python/debug/lib/debug_gradients_test.py b/tensorflow/python/debug/lib/debug_gradients_test.py index 1c531478638..885691c3ef7 100644 --- a/tensorflow/python/debug/lib/debug_gradients_test.py +++ b/tensorflow/python/debug/lib/debug_gradients_test.py @@ -36,6 +36,7 @@ from tensorflow.python.platform import googletest from tensorflow.python.training import gradient_descent +@test_util.run_v1_only("b/120545219") class IdentifyGradientTest(test_util.TensorFlowTestCase): def setUp(self): @@ -54,7 +55,6 @@ class IdentifyGradientTest(test_util.TensorFlowTestCase): ops.reset_default_graph() debug_gradients.clear_gradient_debuggers() - @test_util.run_deprecated_v1 def testIdentifyGradientGivesCorrectTensorObjectWithoutContextManager(self): grad_debugger = debug_gradients.GradientsDebugger() id_grad_w = grad_debugger.identify_gradient(self.w) @@ -85,7 +85,6 @@ class IdentifyGradientTest(test_util.TensorFlowTestCase): self.assertIsInstance(w_grad, ops.Tensor) self.assertAllClose(1.0, self.sess.run(w_grad)) - @test_util.run_deprecated_v1 def testIdentifyGradientGivesCorrectTensorObjectWithTfGradients(self): grad_debugger = debug_gradients.GradientsDebugger() id_grad_w = grad_debugger.identify_gradient(self.w) @@ -117,7 +116,6 @@ class IdentifyGradientTest(test_util.TensorFlowTestCase): self.assertIsInstance(w_grad, ops.Tensor) self.assertAllClose(1.0, self.sess.run(w_grad)) - @test_util.run_deprecated_v1 def testCallingIdentifyGradientTwiceWithTheSameGradientsDebuggerErrors(self): grad_debugger = debug_gradients.GradientsDebugger() grad_debugger.identify_gradient(self.w) @@ -125,7 +123,6 @@ class IdentifyGradientTest(test_util.TensorFlowTestCase): "The graph already contains an op named .*"): grad_debugger.identify_gradient(self.w) - @test_util.run_deprecated_v1 def testIdentifyGradientWorksOnMultipleLosses(self): grad_debugger_1 = debug_gradients.GradientsDebugger() grad_debugger_2 = debug_gradients.GradientsDebugger() @@ -154,7 +151,6 @@ class IdentifyGradientTest(test_util.TensorFlowTestCase): self.assertAllClose(2.0 * 5.0, self.sess.run(dz1_dy)) self.assertAllClose(0.5 * (5.0**-0.5), self.sess.run(dz2_dy)) - @test_util.run_deprecated_v1 def testIdentifyGradientRaisesLookupErrorForUnknownXTensor(self): grad_debugger_1 = debug_gradients.GradientsDebugger() grad_debugger_2 = debug_gradients.GradientsDebugger() @@ -175,7 +171,6 @@ class IdentifyGradientTest(test_util.TensorFlowTestCase): r"This GradientsDebugger has not received any gradient tensor for "): grad_debugger_2.gradient_tensor(self.w) - @test_util.run_deprecated_v1 def testIdentifyGradientRaisesTypeErrorForNonTensorOrTensorNameInput(self): grad_debugger = debug_gradients.GradientsDebugger() with self.assertRaisesRegexp( @@ -184,7 +179,6 @@ class IdentifyGradientTest(test_util.TensorFlowTestCase): r"has type .*Operation.*"): grad_debugger.gradient_tensor(variables.global_variables_initializer()) - @test_util.run_deprecated_v1 def testIdentifyGradientTensorWorksWithGradientDescentOptimizer(self): grad_debugger = debug_gradients.GradientsDebugger() id_grad_w = grad_debugger.identify_gradient(self.w) @@ -200,7 +194,6 @@ class IdentifyGradientTest(test_util.TensorFlowTestCase): self.assertIsInstance(w_grad, ops.Tensor) self.assertAllClose(1.0, self.sess.run(w_grad)) - @test_util.run_deprecated_v1 def testWatchGradientsByXTensorNamesWorks(self): y = math_ops.add(self.w, -1.0, name="y") @@ -227,7 +220,6 @@ class IdentifyGradientTest(test_util.TensorFlowTestCase): self.assertIsInstance(w_grad, ops.Tensor) self.assertAllClose(1.0, self.sess.run(w_grad)) - @test_util.run_deprecated_v1 def testWatchGradientsByXTensorNamesWorksWithoutContextManager(self): y = math_ops.add(self.w, -1.0, name="y") @@ -254,7 +246,6 @@ class IdentifyGradientTest(test_util.TensorFlowTestCase): self.assertIsInstance(w_grad, ops.Tensor) self.assertAllClose(1.0, self.sess.run(w_grad)) - @test_util.run_deprecated_v1 def testWatchGradientsWorksOnRefTensor(self): y = math_ops.add(self.w, -1.0, name="y") @@ -273,7 +264,6 @@ class IdentifyGradientTest(test_util.TensorFlowTestCase): self.assertAllClose(3.0, self.sess.run( grad_debugger.gradient_tensor("u:0"))) - @test_util.run_deprecated_v1 def testWatchGradientsWorksOnMultipleTensors(self): y = math_ops.add(self.w, -1.0, name="y") @@ -294,7 +284,6 @@ class IdentifyGradientTest(test_util.TensorFlowTestCase): self.assertAllClose(3.0, self.sess.run( grad_debugger.gradient_tensor("u:0"))) - @test_util.run_deprecated_v1 def testWatchGradientsByXTensorsWorks(self): y = math_ops.add(self.w, -1.0, name="foo/y") z = math_ops.square(y, name="foo/z") @@ -317,7 +306,6 @@ class IdentifyGradientTest(test_util.TensorFlowTestCase): self.assertAllClose(10.0, self.sess.run(w_grad)) self.assertAllClose(30.0, self.sess.run(u_grad)) - @test_util.run_deprecated_v1 def testWatchGradientsByTensorCanWorkOnMultipleLosses(self): y = math_ops.add(self.w, -1.0, name="y") z1 = math_ops.square(y, name="z1") @@ -343,7 +331,6 @@ class IdentifyGradientTest(test_util.TensorFlowTestCase): self.assertAllClose(2.0 * 5.0, self.sess.run(dz1_dy)) self.assertAllClose(0.5 * (5.0**-0.5), self.sess.run(dz2_dy)) - @test_util.run_deprecated_v1 def testGradientsValuesFromDumpWorks(self): y = math_ops.add(self.w, -1.0, name="y") z = math_ops.square(y, name="z") diff --git a/tensorflow/python/debug/lib/debug_utils_test.py b/tensorflow/python/debug/lib/debug_utils_test.py index cf59b30e3da..9d59cfc1792 100644 --- a/tensorflow/python/debug/lib/debug_utils_test.py +++ b/tensorflow/python/debug/lib/debug_utils_test.py @@ -185,7 +185,7 @@ class DebugUtilsTest(test_util.TensorFlowTestCase): self.assertEqual(["file:///tmp/tfdbg_1", "file:///tmp/tfdbg_2"], watch_0.debug_urls) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testWatchGraph_allNodes(self): debug_utils.watch_graph( self._run_options, @@ -217,7 +217,7 @@ class DebugUtilsTest(test_util.TensorFlowTestCase): self.assertTrue("p1" in node_names) self.assertTrue("s" in node_names) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testWatchGraph_nodeNameWhitelist(self): debug_utils.watch_graph( self._run_options, @@ -232,7 +232,7 @@ class DebugUtilsTest(test_util.TensorFlowTestCase): sorted(["a1_init", "a1", "a1/Assign", "a1/read", "p1"]), sorted(node_names)) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testWatchGraph_opTypeWhitelist(self): debug_utils.watch_graph( self._run_options, @@ -258,7 +258,7 @@ class DebugUtilsTest(test_util.TensorFlowTestCase): ["DebugIdentity"], ["file:///tmp/tfdbg_1"]) self.assertEqual(["p1"], node_names) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testWatchGraph_tensorDTypeWhitelist(self): debug_utils.watch_graph( self._run_options, @@ -271,7 +271,7 @@ class DebugUtilsTest(test_util.TensorFlowTestCase): ["DebugIdentity"], ["file:///tmp/tfdbg_1"]) self.assertItemsEqual(["a1", "a1/Assign", "b", "b/Assign"], node_names) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testWatchGraph_nodeNameAndTensorDTypeWhitelists(self): debug_utils.watch_graph( self._run_options, @@ -285,7 +285,7 @@ class DebugUtilsTest(test_util.TensorFlowTestCase): ["DebugIdentity"], ["file:///tmp/tfdbg_1"]) self.assertItemsEqual(["a1", "a1/Assign"], node_names) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testWatchGraph_nodeNameBlacklist(self): debug_utils.watch_graph_with_blacklists( self._run_options, @@ -300,7 +300,7 @@ class DebugUtilsTest(test_util.TensorFlowTestCase): sorted(["b_init", "b", "b/Assign", "b/read", "c", "s"]), sorted(node_names)) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testWatchGraph_opTypeBlacklist(self): debug_utils.watch_graph_with_blacklists( self._run_options, @@ -313,7 +313,7 @@ class DebugUtilsTest(test_util.TensorFlowTestCase): ["DebugIdentity"], ["file:///tmp/tfdbg_1"]) self.assertEqual(sorted(["p1", "s"]), sorted(node_names)) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testWatchGraph_nodeNameAndOpTypeBlacklists(self): debug_utils.watch_graph_with_blacklists( self._run_options, @@ -327,7 +327,7 @@ class DebugUtilsTest(test_util.TensorFlowTestCase): ["DebugIdentity"], ["file:///tmp/tfdbg_1"]) self.assertEqual(["s"], node_names) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testWatchGraph_tensorDTypeBlacklists(self): debug_utils.watch_graph_with_blacklists( self._run_options, @@ -344,7 +344,7 @@ class DebugUtilsTest(test_util.TensorFlowTestCase): self.assertNotIn("b/Assign", node_names) self.assertIn("s", node_names) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testWatchGraph_nodeNameAndTensorDTypeBlacklists(self): debug_utils.watch_graph_with_blacklists( self._run_options, diff --git a/tensorflow/python/debug/lib/dist_session_debug_grpc_test.py b/tensorflow/python/debug/lib/dist_session_debug_grpc_test.py index 74498c8ea3d..2405e29aaa5 100644 --- a/tensorflow/python/debug/lib/dist_session_debug_grpc_test.py +++ b/tensorflow/python/debug/lib/dist_session_debug_grpc_test.py @@ -44,6 +44,7 @@ from tensorflow.python.platform import test from tensorflow.python.platform import tf_logging +@test_util.run_v1_only("b/120545219") class DistributedSessionDebugTest(test_util.TensorFlowTestCase): """Test the debugging of distributed sessions.""" diff --git a/tensorflow/python/debug/lib/session_debug_file_test.py b/tensorflow/python/debug/lib/session_debug_file_test.py index f5f9ba29ab5..16ab815d92d 100644 --- a/tensorflow/python/debug/lib/session_debug_file_test.py +++ b/tensorflow/python/debug/lib/session_debug_file_test.py @@ -34,6 +34,7 @@ from tensorflow.python.ops import variables from tensorflow.python.platform import googletest +@test_util.run_v1_only("b/120545219") class SessionDebugFileTest(session_debug_testlib.SessionDebugTestBase): def _debug_urls(self, run_number=None): @@ -45,7 +46,6 @@ class SessionDebugFileTest(session_debug_testlib.SessionDebugTestBase): else: return os.path.join(self._dump_root, "run_%d" % run_number) - @test_util.run_deprecated_v1 def testAllowsDifferentWatchesOnDifferentRuns(self): """Test watching different tensors on different runs of the same graph.""" diff --git a/tensorflow/python/debug/lib/session_debug_grpc_test.py b/tensorflow/python/debug/lib/session_debug_grpc_test.py index bfc9a3a3827..472e2449156 100644 --- a/tensorflow/python/debug/lib/session_debug_grpc_test.py +++ b/tensorflow/python/debug/lib/session_debug_grpc_test.py @@ -91,6 +91,7 @@ class GrpcDebugServerTest(test_util.TensorFlowTestCase): server.stop_server().wait() +@test_util.run_v1_only("b/120545219") class SessionDebugGrpcTest(session_debug_testlib.SessionDebugTestBase): @classmethod @@ -353,6 +354,7 @@ class SessionDebugConcurrentTest( return urls +@test_util.run_v1_only("b/120545219") class SessionDebugGrpcGatingTest(test_util.TensorFlowTestCase): """Test server gating of debug ops.""" @@ -730,6 +732,7 @@ class SessionDebugGrpcGatingTest(test_util.TensorFlowTestCase): self.assertEqual("DebugNumericSummary", debug_watch.debug_op) +@test_util.run_v1_only("b/120545219") class DelayedDebugServerTest(test_util.TensorFlowTestCase): def testDebuggedSessionRunWorksWithDelayedDebugServerStartup(self): diff --git a/tensorflow/python/debug/lib/session_debug_testlib.py b/tensorflow/python/debug/lib/session_debug_testlib.py index 25ef91b5759..5165febff52 100644 --- a/tensorflow/python/debug/lib/session_debug_testlib.py +++ b/tensorflow/python/debug/lib/session_debug_testlib.py @@ -84,6 +84,7 @@ class _RNNCellForTest(rnn_cell_impl.RNNCell): return (math_ops.multiply(self._w, input_), state) +@test_util.run_v1_only("b/120545219") class SessionDebugTestBase(test_util.TensorFlowTestCase): """Base class for unit tests of tfdbg running with tf.Session.""" diff --git a/tensorflow/python/debug/lib/source_utils_test.py b/tensorflow/python/debug/lib/source_utils_test.py index 9083297fdbb..4f4aea03213 100644 --- a/tensorflow/python/debug/lib/source_utils_test.py +++ b/tensorflow/python/debug/lib/source_utils_test.py @@ -216,6 +216,7 @@ class SourceHelperTest(test_util.TensorFlowTestCase): os.remove(unrelated_source_path) +@test_util.run_v1_only("b/120545219") class ListSourceAgainstDumpTest(test_util.TensorFlowTestCase): def createAndRunGraphWithWhileLoop(self): diff --git a/tensorflow/python/debug/lib/stepper_test.py b/tensorflow/python/debug/lib/stepper_test.py index 3839c671982..9e78e207b80 100644 --- a/tensorflow/python/debug/lib/stepper_test.py +++ b/tensorflow/python/debug/lib/stepper_test.py @@ -33,6 +33,7 @@ from tensorflow.python.platform import googletest from tensorflow.python.training import gradient_descent +@test_util.run_v1_only("b/120545219") class StepperTest(test_util.TensorFlowTestCase): def setUp(self): @@ -443,6 +444,7 @@ class StepperTest(test_util.TensorFlowTestCase): self.assertAllClose(-4.0, result["fz"]["z"]) +@test_util.run_v1_only("b/120545219") class StepperTestWithPlaceHolders(test_util.TensorFlowTestCase): def setUp(self): @@ -577,6 +579,7 @@ class StepperTestWithPlaceHolders(test_util.TensorFlowTestCase): self.assertAllClose([[-1.0], [6.0]], stepper.finalize()) +@test_util.run_v1_only("b/120545219") class StepperAssignAddTest(test_util.TensorFlowTestCase): def setUp(self): @@ -692,6 +695,7 @@ class StepperAssignAddTest(test_util.TensorFlowTestCase): self.assertAllClose(12.0, stepper.cont(self.v)) +@test_util.run_v1_only("b/120545219") class StepperBackwardRunTest(test_util.TensorFlowTestCase): def setUp(self): diff --git a/tensorflow/python/debug/wrappers/disk_usage_test.py b/tensorflow/python/debug/wrappers/disk_usage_test.py index 0874525966c..88b1cd540de 100644 --- a/tensorflow/python/debug/wrappers/disk_usage_test.py +++ b/tensorflow/python/debug/wrappers/disk_usage_test.py @@ -32,6 +32,7 @@ from tensorflow.python.platform import googletest from tensorflow.python.training import monitored_session +@test_util.run_v1_only("b/120545219") class DumpingDebugWrapperDiskUsageLimitTest(test_util.TensorFlowTestCase): @classmethod diff --git a/tensorflow/python/debug/wrappers/dumping_wrapper_test.py b/tensorflow/python/debug/wrappers/dumping_wrapper_test.py index 11011a5c134..42e3b09382d 100644 --- a/tensorflow/python/debug/wrappers/dumping_wrapper_test.py +++ b/tensorflow/python/debug/wrappers/dumping_wrapper_test.py @@ -41,6 +41,7 @@ from tensorflow.python.platform import googletest from tensorflow.python.training import monitored_session +@test_util.run_v1_only("b/120545219") class DumpingDebugWrapperSessionTest(test_util.TensorFlowTestCase): def setUp(self): diff --git a/tensorflow/python/debug/wrappers/framework_test.py b/tensorflow/python/debug/wrappers/framework_test.py index 68584b4ede4..a50fa7cf4b8 100644 --- a/tensorflow/python/debug/wrappers/framework_test.py +++ b/tensorflow/python/debug/wrappers/framework_test.py @@ -141,6 +141,7 @@ class TestDebugWrapperSessionBadAction(framework.BaseDebugWrapperSession): return framework.OnRunEndResponse() +@test_util.run_v1_only("b/120545219") class DebugWrapperSessionTest(test_util.TensorFlowTestCase): def _no_rewrite_session_config(self): diff --git a/tensorflow/python/debug/wrappers/local_cli_wrapper_test.py b/tensorflow/python/debug/wrappers/local_cli_wrapper_test.py index 149a7497df8..e38df861f5b 100644 --- a/tensorflow/python/debug/wrappers/local_cli_wrapper_test.py +++ b/tensorflow/python/debug/wrappers/local_cli_wrapper_test.py @@ -127,6 +127,7 @@ class LocalCLIDebuggerWrapperSessionForTest( return e.exit_token +@test_util.run_v1_only("b/120545219") class LocalCLIDebugWrapperSessionTest(test_util.TensorFlowTestCase): def setUp(self): diff --git a/tensorflow/python/distribute/distribute_coordinator_test.py b/tensorflow/python/distribute/distribute_coordinator_test.py index f2cb950aada..7598c105c2d 100644 --- a/tensorflow/python/distribute/distribute_coordinator_test.py +++ b/tensorflow/python/distribute/distribute_coordinator_test.py @@ -427,6 +427,7 @@ class DistributeCoordinatorTestStandaloneMode(DistributeCoordinatorTestBase): # Each finished worker will increment self._result_correct. self.assertEqual(self._result_correct, NUM_WORKERS) + @test_util.run_v1_only("b/120545219") def testBetweenGraphWithMonitoredSession(self): """Test monitored session in standalone client mode.""" distribute_coordinator.run_distribute_coordinator( @@ -600,6 +601,7 @@ class DistributeCoordinatorTestInpendentWorkerMode( # Each finished worker will increment self._result_correct. self.assertEqual(self._result_correct, NUM_WORKERS) + @test_util.run_v1_only("b/120545219") def testBetweenGraphWithMonitoredSession(self): cluster_spec = self._create_cluster_spec( num_workers=NUM_WORKERS, num_ps=NUM_PS) diff --git a/tensorflow/python/eager/backprop_test.py b/tensorflow/python/eager/backprop_test.py index 3cec40a48f7..61c47a29fd2 100644 --- a/tensorflow/python/eager/backprop_test.py +++ b/tensorflow/python/eager/backprop_test.py @@ -648,6 +648,7 @@ class BackpropTest(test.TestCase): g.gradient(x, y) @test_util.run_in_graph_and_eager_modes + @test_util.run_v1_only('b/120545219') def testGradientTapeWithCond(self): x = constant_op.constant(3.0) @@ -669,6 +670,7 @@ class BackpropTest(test.TestCase): self.assertEqual(self.evaluate(dy), 6.0) @test_util.run_in_graph_and_eager_modes + @test_util.run_v1_only('b/120545219') def testGradientTapeWithWhileLoop(self): i = constant_op.constant(1) x = constant_op.constant(2.) @@ -704,6 +706,7 @@ class BackpropTest(test.TestCase): @test_util.assert_no_new_tensors @test_util.run_in_graph_and_eager_modes + @test_util.run_v1_only('b/120545219') def testPersistentTape(self): with backprop.GradientTape(persistent=True) as g: x = constant_op.constant(3.0) @@ -1243,16 +1246,19 @@ class JacobianTest(test.TestCase): answer = [array_ops.diag(2 * x * y), array_ops.diag(x * x)] return jacobian, answer + @test_util.run_v1_only('b/120545219') def testPfor(self): jacobian, answer = self._jacobian(experimental_use_pfor=True) for j, a in zip(jacobian, answer): self.assertAllEqual(a, j) + @test_util.run_v1_only('b/120545219') def testWhileLoop(self): jacobian, answer = self._jacobian(experimental_use_pfor=False) for j, a in zip(jacobian, answer): self.assertAllEqual(a, j) + @test_util.run_v1_only('b/120545219') def testPforDefun(self): @function.defun @@ -1263,6 +1269,7 @@ class JacobianTest(test.TestCase): for j, a in zip(jacobian, answer): self.assertAllEqual(a, j) + @test_util.run_v1_only('b/120545219') def testWhileLoopDefun(self): @function.defun @@ -1273,6 +1280,7 @@ class JacobianTest(test.TestCase): for j, a in zip(jacobian, answer): self.assertAllEqual(a, j) + @test_util.run_v1_only('b/120545219') def testPersistentTape(self): if not context.executing_eagerly(): return @@ -1283,6 +1291,7 @@ class JacobianTest(test.TestCase): with self.assertRaisesRegexp(RuntimeError, 'persistent'): g.jacobian(y, x, experimental_use_pfor=False) + @test_util.run_v1_only('b/120545219') def testPforException(self): var = variables.Variable([1.]) @@ -1303,6 +1312,7 @@ class JacobianTest(test.TestCase): with self.assertRaisesRegexp(ValueError, 'No converter'): g.jacobian(y, x, experimental_use_pfor=True) + @test_util.run_v1_only('b/120545219') def test_parallel_iterations(self): with backprop.GradientTape(persistent=True) as g: x = constant_op.constant([[1., 2], [3, 4]]) @@ -1328,14 +1338,17 @@ class BatchJacobianTest(test.TestCase): array_ops.diag(2 * x[1] * y[1])]) return batch_jacobian, answer + @test_util.run_v1_only('b/120545219') def testPfor(self): batch_jacobian, answer = self._batch_jacobian(experimental_use_pfor=True) self.assertAllEqual(answer, batch_jacobian) + @test_util.run_v1_only('b/120545219') def testWhileLoop(self): batch_jacobian, answer = self._batch_jacobian(experimental_use_pfor=False) self.assertAllEqual(answer, batch_jacobian) + @test_util.run_v1_only('b/120545219') def testPforDefun(self): @function.defun @@ -1345,6 +1358,7 @@ class BatchJacobianTest(test.TestCase): batch_jacobian, answer = _f() self.assertAllEqual(answer, batch_jacobian) + @test_util.run_v1_only('b/120545219') def testWhileLoopDefun(self): @function.defun @@ -1354,6 +1368,7 @@ class BatchJacobianTest(test.TestCase): batch_jacobian, answer = _f() self.assertAllEqual(answer, batch_jacobian) + @test_util.run_v1_only('b/120545219') def testPersistentTape(self): if not context.executing_eagerly(): return @@ -1364,6 +1379,7 @@ class BatchJacobianTest(test.TestCase): with self.assertRaisesRegexp(RuntimeError, 'persistent'): g.batch_jacobian(y, x, experimental_use_pfor=False) + @test_util.run_v1_only('b/120545219') def testBadShape(self): x = random_ops.random_uniform([2, 3]) with backprop.GradientTape() as g: @@ -1371,6 +1387,7 @@ class BatchJacobianTest(test.TestCase): with self.assertRaisesRegexp(ValueError, 'Need first dimension'): g.batch_jacobian(y, x) + @test_util.run_v1_only('b/120545219') def testBadInputRank(self): x = random_ops.random_uniform([2]) with backprop.GradientTape() as g: @@ -1385,6 +1402,7 @@ class BatchJacobianTest(test.TestCase): with self.assertRaisesRegexp(ValueError, 'must have rank at least 2'): g.batch_jacobian(y, x) + @test_util.run_v1_only('b/120545219') def testPforException(self): var = variables.Variable([1.]) @@ -1405,6 +1423,7 @@ class BatchJacobianTest(test.TestCase): with self.assertRaisesRegexp(ValueError, 'No converter'): g.batch_jacobian(y, x, experimental_use_pfor=True) + @test_util.run_v1_only('b/120545219') def test_parallel_iterations(self): with backprop.GradientTape(persistent=True) as g: x = constant_op.constant([[1., 2], [3, 4]]) diff --git a/tensorflow/python/eager/function_gradients_test.py b/tensorflow/python/eager/function_gradients_test.py index 9b83f57089a..98dec0b361b 100644 --- a/tensorflow/python/eager/function_gradients_test.py +++ b/tensorflow/python/eager/function_gradients_test.py @@ -187,7 +187,7 @@ class FunctionGradientsTest(test.TestCase, parameterized.TestCase): self.assertAllEqual(2, g(constant_op.constant(2.))) - @test_util.run_deprecated_v1 + @test_util.run_v1_only('b/120545219') def testGraphModeEagerGradError(self): with context.graph_mode(): def f(): diff --git a/tensorflow/python/eager/function_test.py b/tensorflow/python/eager/function_test.py index e0854b06321..50d1b4b6f77 100644 --- a/tensorflow/python/eager/function_test.py +++ b/tensorflow/python/eager/function_test.py @@ -963,6 +963,7 @@ class FunctionTest(test.TestCase, parameterized.TestCase): # construction. Eager's configuration is controlled in `__main__`. @test_util.run_in_graph_and_eager_modes( config=config_pb2.ConfigProto(device_count={'CPU': 4})) + @test_util.run_v1_only('b/120545219') def testDeviceAnnotationsRespected(self): def multi_device_fn(): @@ -1001,6 +1002,7 @@ class FunctionTest(test.TestCase, parameterized.TestCase): @test_util.run_in_graph_and_eager_modes( config=config_pb2.ConfigProto(device_count={'CPU': 2})) + @test_util.run_v1_only('b/120545219') def testCallingGraphFunctionOnDifferentDevice(self): def func(): diff --git a/tensorflow/python/framework/auto_control_deps_test.py b/tensorflow/python/framework/auto_control_deps_test.py index a1dff9e8349..5f5de45b9ee 100644 --- a/tensorflow/python/framework/auto_control_deps_test.py +++ b/tensorflow/python/framework/auto_control_deps_test.py @@ -24,6 +24,7 @@ from tensorflow.python.framework import auto_control_deps as acd from tensorflow.python.framework import constant_op from tensorflow.python.framework import dtypes from tensorflow.python.framework import ops +from tensorflow.python.framework import test_util from tensorflow.python.ops import array_ops from tensorflow.python.ops import control_flow_ops from tensorflow.python.ops import resource_variable_ops @@ -46,6 +47,7 @@ class AutomaticControlDependenciesTest(test.TestCase): val = c.mark_as_return(val) self.assertAllEqual(val.eval(), 4.0) + @test_util.run_v1_only("b/120545219") def testCondMustRun(self): with context.graph_mode(), self.cached_session(): v = resource_variable_ops.ResourceVariable(1.0) @@ -67,6 +69,7 @@ class AutomaticControlDependenciesTest(test.TestCase): self.assertAllEqual(val.eval(feed_dict={p: False}), 5.0) self.assertAllEqual(val.eval(feed_dict={p: True}), 6.0) + @test_util.run_v1_only("b/120545219") def testCondMustRunSeparateRead(self): with context.graph_mode(), self.cached_session(): v = resource_variable_ops.ResourceVariable(1.0) @@ -90,6 +93,7 @@ class AutomaticControlDependenciesTest(test.TestCase): one.eval(feed_dict={p: True}) self.assertAllEqual(v.read_value().eval(), 6.0) + @test_util.run_v1_only("b/120545219") def testCondNested(self): with context.graph_mode(), self.cached_session(): v = resource_variable_ops.ResourceVariable(1.0) @@ -124,6 +128,7 @@ class AutomaticControlDependenciesTest(test.TestCase): self.assertAllEqual(val.eval(feed_dict={p: True, q: True}), 7.0) self.assertAllEqual(val.eval(feed_dict={p: True, q: False}), 8.0) + @test_util.run_v1_only("b/120545219") def testCondOneBranch(self): with context.graph_mode(), self.cached_session(): v = resource_variable_ops.ResourceVariable(1.0) @@ -144,6 +149,7 @@ class AutomaticControlDependenciesTest(test.TestCase): self.assertAllEqual(val.eval(feed_dict={p: False}), 5.0) self.assertAllEqual(val.eval(feed_dict={p: True}), 5.0) + @test_util.run_v1_only("b/120545219") def testCondOneBranchUpdateBefore(self): with context.graph_mode(), self.cached_session(): v = resource_variable_ops.ResourceVariable(1.0) @@ -165,6 +171,7 @@ class AutomaticControlDependenciesTest(test.TestCase): self.assertAllEqual(val.eval(feed_dict={p: False}), 6.0) self.assertAllEqual(val.eval(feed_dict={p: True}), 12.0) + @test_util.run_v1_only("b/120545219") def testCondOneBranchUpdateAfter(self): with context.graph_mode(), self.cached_session(): v = resource_variable_ops.ResourceVariable(1.0) diff --git a/tensorflow/python/framework/error_interpolation_test.py b/tensorflow/python/framework/error_interpolation_test.py index 1b77548592c..9eaa4a5f2d0 100644 --- a/tensorflow/python/framework/error_interpolation_test.py +++ b/tensorflow/python/framework/error_interpolation_test.py @@ -23,6 +23,7 @@ import os from tensorflow.python.framework import constant_op from tensorflow.python.framework import error_interpolation from tensorflow.python.framework import ops +from tensorflow.python.framework import test_util from tensorflow.python.framework import traceable_stack from tensorflow.python.platform import test from tensorflow.python.util import tf_stack @@ -112,6 +113,7 @@ class ComputeColocationSummaryFromOpTest(test.TestCase): self.assertIn("No node-device colocations", summary) +@test_util.run_v1_only("b/120545219") class InterpolateFilenamesAndLineNumbersTest(test.TestCase): def setUp(self): @@ -193,6 +195,7 @@ class InterpolateFilenamesAndLineNumbersTest(test.TestCase): self.assertRegexpMatches(interpolated_string, "constant_op.py:[0-9]+.*") +@test_util.run_v1_only("b/120545219") class InterpolateDeviceSummaryTest(test.TestCase): def _fancy_device_function(self, unused_op): @@ -236,6 +239,7 @@ class InterpolateDeviceSummaryTest(test.TestCase): self.assertRegexpMatches(result, expected_re) +@test_util.run_v1_only("b/120545219") class InterpolateColocationSummaryTest(test.TestCase): def setUp(self): @@ -260,11 +264,13 @@ class InterpolateColocationSummaryTest(test.TestCase): self.graph = node_three.graph + @test_util.run_v1_only("b/120545219") def testNodeThreeHasColocationInterpolation(self): message = "{{colocation_node Three_with_one}}" result = error_interpolation.interpolate(message, self.graph) self.assertIn("colocate_with(One)", result) + @test_util.run_v1_only("b/120545219") def testNodeFourHasColocationInterpolationForNodeThreeOnly(self): message = "{{colocation_node Four_with_three}}" result = error_interpolation.interpolate(message, self.graph) @@ -273,12 +279,14 @@ class InterpolateColocationSummaryTest(test.TestCase): "One", result, "Node One should not appear in Four_with_three's summary:\n%s" % result) + @test_util.run_v1_only("b/120545219") def testNodeFiveHasColocationInterpolationForNodeOneAndTwo(self): message = "{{colocation_node Five_with_one_with_two}}" result = error_interpolation.interpolate(message, self.graph) self.assertIn("colocate_with(One)", result) self.assertIn("colocate_with(Two)", result) + @test_util.run_v1_only("b/120545219") def testColocationInterpolationForNodeLackingColocation(self): message = "{{colocation_node One}}" result = error_interpolation.interpolate(message, self.graph) diff --git a/tensorflow/python/framework/graph_util_test.py b/tensorflow/python/framework/graph_util_test.py index 4e7408ad49f..dd26b8a78e9 100644 --- a/tensorflow/python/framework/graph_util_test.py +++ b/tensorflow/python/framework/graph_util_test.py @@ -103,7 +103,7 @@ class DeviceFunctionsTest(test.TestCase): self.assertDeviceEqual(var_5.device, "/device:GPU:0") self.assertDeviceEqual(var_6.device, "/device:CPU:0") - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testNestedDeviceFunctions(self): with ops.Graph().as_default(): var_0 = variables.VariableV1(0) diff --git a/tensorflow/python/framework/meta_graph_test.py b/tensorflow/python/framework/meta_graph_test.py index 46ce4616a50..e6e87881649 100644 --- a/tensorflow/python/framework/meta_graph_test.py +++ b/tensorflow/python/framework/meta_graph_test.py @@ -528,7 +528,7 @@ class ScopedMetaGraphTest(test.TestCase): actual_grad_value = self.evaluate(grad) self.assertEqual(expected_grad_value, actual_grad_value) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testImportWhileLoopInWhileLoop(self): # Create a simple while loop. with ops.Graph().as_default(): diff --git a/tensorflow/python/framework/ops_test.py b/tensorflow/python/framework/ops_test.py index 7baa02b446b..0fcbcd6ee4d 100644 --- a/tensorflow/python/framework/ops_test.py +++ b/tensorflow/python/framework/ops_test.py @@ -605,6 +605,7 @@ class OperationTest(test_util.TensorFlowTestCase): x.op._update_input(1, x) # pylint: disable=protected-access @test_util.enable_control_flow_v2 + @test_util.run_v1_only("b/120545219") def testAddWhileInput(self): @eager_function.defun def test(): @@ -780,7 +781,7 @@ class CreateOpFromTFOperationTest(test_util.TensorFlowTestCase): self.assertEqual(op3.name, "myop_2") self.assertEqual(op4.name, "myop_1_1") - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testCond(self): g = ops.Graph() with g.as_default(): @@ -810,7 +811,7 @@ class CreateOpFromTFOperationTest(test_util.TensorFlowTestCase): "cond/cond_text") # pylint: enable=protected-access - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testWhileLoop(self): g = ops.Graph() with g.as_default(): @@ -840,7 +841,7 @@ class CreateOpFromTFOperationTest(test_util.TensorFlowTestCase): "myloop/while_context") # pylint: enable=protected-access - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testWhileLoopWithInternalControlDep(self): g = ops.Graph() with g.as_default(): @@ -864,7 +865,7 @@ class CreateOpFromTFOperationTest(test_util.TensorFlowTestCase): # Internal control dep is preserved self.assertEqual(op.control_inputs, [c]) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testWhileLoopWithExternalControlDep(self): g = ops.Graph() with g.as_default(): @@ -2283,7 +2284,7 @@ class InitScopeTest(test_util.TensorFlowTestCase): self.assertEqual(4, int(compiled_outer(inner=compiled_inner))) self.assertEqual(7, int(compiled_outer(inner=compiled_inner))) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testFallsBackToGlobalGraphWhenAllGraphsAreBuildingFunctions(self): with context.graph_mode(): ops.reset_default_graph() @@ -2994,7 +2995,7 @@ class TracebackTest(test_util.TensorFlowTestCase): class EnableEagerExecutionTest(test_util.TensorFlowTestCase): - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testBadArgumentsToEnableEagerExecution(self): with self.assertRaisesRegexp(TypeError, "config must be a tf.ConfigProto"): ops.enable_eager_execution(context.DEVICE_PLACEMENT_SILENT) diff --git a/tensorflow/python/framework/subscribe_test.py b/tensorflow/python/framework/subscribe_test.py index 61c6ea65190..a74e96f9d9d 100644 --- a/tensorflow/python/framework/subscribe_test.py +++ b/tensorflow/python/framework/subscribe_test.py @@ -215,7 +215,7 @@ class SubscribeTest(test_util.TensorFlowTestCase): self.assertIn('graph2', shared) self.assertIn('graph3', shared) - @test_util.run_deprecated_v1 + @test_util.run_v1_only('b/120545219') def testSubscribeVariable(self): """Confirm that variables can be subscribed.""" v1 = variables.VariableV1(0.0) @@ -254,7 +254,7 @@ class SubscribeTest(test_util.TensorFlowTestCase): # Make sure the values read from the variable match the expected ones. self.assertEqual([0.0, 3.0], shared) - @test_util.run_deprecated_v1 + @test_util.run_v1_only('b/120545219') def testResourceType(self): """Confirm that subscribe correctly handles tensors with 'resource' type.""" tensor_array = tensor_array_ops.TensorArray( @@ -344,7 +344,7 @@ class SubscribeTest(test_util.TensorFlowTestCase): self.assertEqual(add.device, add_sub.device) self.assertEqual(mul.device, mul_sub.device) - @test_util.run_deprecated_v1 + @test_util.run_v1_only('b/120545219') def test_subscribe_tensors_within_control_flow_context(self): """Side effect ops are added with the same control flow context.""" c1 = constant_op.constant(10) diff --git a/tensorflow/python/grappler/item_test.py b/tensorflow/python/grappler/item_test.py index 78604b259ca..c02fd9f55b8 100644 --- a/tensorflow/python/grappler/item_test.py +++ b/tensorflow/python/grappler/item_test.py @@ -108,7 +108,7 @@ class ItemTest(test.TestCase): newest_tf_item = grappler_item.tf_item self.assertEqual(new_tf_item, newest_tf_item) - @test_util.run_deprecated_v1 + @test_util.run_v1_only('b/120545219') def testColocationContraints(self): with ops.Graph().as_default() as g: c = constant_op.constant([10]) diff --git a/tensorflow/python/grappler/memory_optimizer_test.py b/tensorflow/python/grappler/memory_optimizer_test.py index 6eb16fbd39e..e2864ebb4df 100644 --- a/tensorflow/python/grappler/memory_optimizer_test.py +++ b/tensorflow/python/grappler/memory_optimizer_test.py @@ -62,7 +62,7 @@ class MemoryOptimizerSwapTest(test.TestCase): self.assertEqual(len(graph.node), graph_size) self.assertItemsEqual([node.name for node in graph.node], nodes) - @test_util.run_deprecated_v1 + @test_util.run_v1_only('b/120545219') def testSimpleSwap(self): """Check that the swap annotations are followed.""" a = variables.VariableV1(10, name='a') diff --git a/tensorflow/python/grappler/tf_optimizer_test.py b/tensorflow/python/grappler/tf_optimizer_test.py index 06ccaa813f2..8186c81378a 100644 --- a/tensorflow/python/grappler/tf_optimizer_test.py +++ b/tensorflow/python/grappler/tf_optimizer_test.py @@ -57,7 +57,7 @@ class PyWrapOptimizeGraphTest(test.TestCase): self.assertEqual(len(graph.node), 1) self.assertItemsEqual([node.name for node in graph.node], ['d']) - @test_util.run_deprecated_v1 + @test_util.run_v1_only('b/120545219') def testKeepNodes(self): g = ops.Graph() with g.as_default(): @@ -86,7 +86,7 @@ class PyWrapOptimizeGraphTest(test.TestCase): self.assertEqual(len(optimized_graph_nodes), len(expected_nodes)) self.assertAllInSet(optimized_graph_nodes, expected_nodes) - @test_util.run_deprecated_v1 + @test_util.run_v1_only('b/120545219') def testLoops(self): g = ops.Graph() with g.as_default(): diff --git a/tensorflow/python/keras/backend_test.py b/tensorflow/python/keras/backend_test.py index 6401e39e53c..af01b46fa9a 100644 --- a/tensorflow/python/keras/backend_test.py +++ b/tensorflow/python/keras/backend_test.py @@ -1422,7 +1422,7 @@ class TestCTC(test.TestCase): decode_truth[i] == keras.backend.eval(decode_pred_tf[i]))) self.assertAllClose(log_prob_truth, log_prob_pred) - @test_util.run_deprecated_v1 + @test_util.run_v1_only('b/120545219') def test_ctc_batch_cost(self): with self.cached_session(): label_lens = np.expand_dims(np.asarray([5, 4]), 1) diff --git a/tensorflow/python/keras/callbacks_test.py b/tensorflow/python/keras/callbacks_test.py index 6c9a382b327..4a65ade33c7 100644 --- a/tensorflow/python/keras/callbacks_test.py +++ b/tensorflow/python/keras/callbacks_test.py @@ -403,7 +403,7 @@ class KerasCallbacksTest(test.TestCase): float(keras.backend.get_value( model.optimizer.lr)) - 0.01 / 4) < keras.backend.epsilon() - @test_util.run_deprecated_v1 + @test_util.run_v1_only('b/120545219') def test_ReduceLROnPlateau(self): with self.cached_session(): np.random.seed(1337) @@ -675,7 +675,7 @@ class KerasCallbacksTest(test.TestCase): self.assertEqual(len(loss), 1) self.assertEqual(loss[0], np.inf) - @test_util.run_deprecated_v1 + @test_util.run_v1_only('b/120545219') def test_TensorBoard(self): np.random.seed(1337) @@ -779,7 +779,7 @@ class KerasCallbacksTest(test.TestCase): data_generator(True), len(x_train), epochs=2, callbacks=cbks) assert os.path.exists(temp_dir) - @test_util.run_deprecated_v1 + @test_util.run_v1_only('b/120545219') def test_TensorBoard_multi_input_output(self): np.random.seed(1337) tmpdir = self.get_temp_dir() @@ -851,7 +851,7 @@ class KerasCallbacksTest(test.TestCase): callbacks=callbacks_factory(histogram_freq=1)) assert os.path.isdir(filepath) - @test_util.run_deprecated_v1 + @test_util.run_v1_only('b/120545219') def test_Tensorboard_histogram_summaries_in_test_function(self): class FileWriterStub(object): @@ -929,7 +929,7 @@ class KerasCallbacksTest(test.TestCase): self.assertAllEqual(tsb.writer.steps_seen, [0, 1, 2, 3, 4, 5]) - @test_util.run_deprecated_v1 + @test_util.run_v1_only('b/120545219') def test_Tensorboard_histogram_summaries_with_generator(self): np.random.seed(1337) tmpdir = self.get_temp_dir() diff --git a/tensorflow/python/keras/engine/saving_test.py b/tensorflow/python/keras/engine/saving_test.py index 6d9d9a2fcae..bc33a3ea7f3 100644 --- a/tensorflow/python/keras/engine/saving_test.py +++ b/tensorflow/python/keras/engine/saving_test.py @@ -332,7 +332,7 @@ class TestWeightSavingAndLoading(test.TestCase, parameterized.TestCase): class TestWholeModelSaving(test.TestCase): - @test_util.run_deprecated_v1 + @test_util.run_v1_only('b/120545219') def test_sequential_model_saving(self): if h5py is None: self.skipTest('h5py required to run this test') @@ -635,7 +635,7 @@ class TestWholeModelSaving(test.TestCase): os.close(fd) os.remove(fname) - @test_util.run_deprecated_v1 + @test_util.run_v1_only('b/120545219') def test_saving_model_with_long_weights_names(self): if h5py is None: self.skipTest('h5py required to run this test') @@ -756,7 +756,7 @@ class SubclassedModel(training.Model): class TestWeightSavingAndLoadingTFFormat(test.TestCase): - @test_util.run_deprecated_v1 + @test_util.run_v1_only('b/120545219') def test_keras_optimizer_warning(self): graph = ops.Graph() with graph.as_default(), self.session(graph): diff --git a/tensorflow/python/keras/engine/sequential_test.py b/tensorflow/python/keras/engine/sequential_test.py index 001c3d749bf..10f69da061c 100644 --- a/tensorflow/python/keras/engine/sequential_test.py +++ b/tensorflow/python/keras/engine/sequential_test.py @@ -226,7 +226,7 @@ class TestSequential(keras_parameterized.TestCase): inner_model.trainable = True self.assertEqual(len(model.trainable_weights), 4) - @tf_test_util.run_deprecated_v1 + @tf_test_util.run_v1_only('b/120545219') def test_sequential_update_disabling(self): val_a = np.random.random((10, 4)) val_out = np.random.random((10, 4)) diff --git a/tensorflow/python/keras/engine/topology_test.py b/tensorflow/python/keras/engine/topology_test.py index 03bfd35589c..4071e2c091e 100644 --- a/tensorflow/python/keras/engine/topology_test.py +++ b/tensorflow/python/keras/engine/topology_test.py @@ -107,6 +107,7 @@ class TopologyConstructionTest(test.TestCase): self.assertEqual(len(network.updates), 5) self.assertEqual(len(network.get_updates_for(x4)), 2) + @test_util.run_v1_only('b/120545219') def test_get_updates_bn(self): x1 = input_layer_lib.Input(shape=(1,)) layer = keras.layers.BatchNormalization() @@ -833,7 +834,7 @@ class TopologyConstructionTest(test.TestCase): output_val_2 = m2.predict(x_val) self.assertAllClose(output_val, output_val_2, atol=1e-6) - @test_util.run_deprecated_v1 + @test_util.run_v1_only('b/120545219') def test_explicit_training_argument(self): with self.cached_session(): a = keras.layers.Input(shape=(2,)) diff --git a/tensorflow/python/keras/engine/training_test.py b/tensorflow/python/keras/engine/training_test.py index c3c3f06ffd3..91a0c7cc2f2 100644 --- a/tensorflow/python/keras/engine/training_test.py +++ b/tensorflow/python/keras/engine/training_test.py @@ -471,7 +471,7 @@ class TrainingTest(keras_parameterized.TestCase): metrics=['accuracy'], run_eagerly=testing_utils.should_run_eagerly()) - @tf_test_util.run_deprecated_v1 + @tf_test_util.run_v1_only('b/120545219') def test_that_trainable_disables_updates(self): val_a = np.random.random((10, 4)) val_out = np.random.random((10, 4)) @@ -864,6 +864,7 @@ class LossWeightingTest(keras_parameterized.TestCase): self.assertLess(score[0], ref_score[0]) @keras_parameterized.run_all_keras_modes + @tf_test_util.run_v1_only('b/120545219') def test_sample_weights(self): num_classes = 5 batch_size = 5 @@ -961,6 +962,7 @@ class LossWeightingTest(keras_parameterized.TestCase): self.assertTrue(msg_found) @keras_parameterized.run_all_keras_modes + @tf_test_util.run_v1_only('b/120545219') # TODO(b/120562577): Test failing with assertion error. def DISABLED_test_temporal_sample_weights(self): num_classes = 5 @@ -1283,7 +1285,7 @@ class LossMaskingTest(keras_parameterized.TestCase): class TestDynamicTrainability(keras_parameterized.TestCase): - @tf_test_util.run_deprecated_v1 + @tf_test_util.run_v1_only('b/120545219') def test_trainable_warning(self): with self.cached_session(): x = np.random.random((5, 3)) @@ -1297,7 +1299,7 @@ class TestDynamicTrainability(keras_parameterized.TestCase): model.train_on_batch(x, y) self.assertRaises(Warning) - @tf_test_util.run_deprecated_v1 + @tf_test_util.run_v1_only('b/120545219') def test_trainable_argument(self): with self.cached_session(): x = np.random.random((5, 3)) diff --git a/tensorflow/python/keras/integration_test.py b/tensorflow/python/keras/integration_test.py index f1a0932613b..c516514f632 100644 --- a/tensorflow/python/keras/integration_test.py +++ b/tensorflow/python/keras/integration_test.py @@ -35,7 +35,7 @@ class KerasIntegrationTest(test.TestCase): def test_version(self): self.assertTrue(keras.__version__.endswith('-tf')) - @test_util.run_deprecated_v1 + @test_util.run_v1_only('b/120545219') def test_vector_classification_sequential(self): with self.cached_session(): np.random.seed(1337) @@ -134,6 +134,7 @@ class KerasIntegrationTest(test.TestCase): verbose=2) self.assertGreater(history.history['val_acc'][-1], 0.7) + @test_util.run_v1_only('b/120545219') def test_image_classification_sequential(self): with self.cached_session(): np.random.seed(1337) @@ -168,7 +169,7 @@ class KerasIntegrationTest(test.TestCase): verbose=2) self.assertGreater(history.history['val_acc'][-1], 0.7) - @test_util.run_deprecated_v1 + @test_util.run_v1_only('b/120545219') def test_video_classification_functional(self): with self.cached_session(): np.random.seed(1337) @@ -197,7 +198,7 @@ class KerasIntegrationTest(test.TestCase): verbose=2) self.assertGreater(history.history['val_acc'][-1], 0.7) - @test_util.run_deprecated_v1 + @test_util.run_v1_only('b/120545219') def test_vector_classification_shared_sequential(self): # Test that Sequential models that feature internal updates # and internal losses can be shared. @@ -232,7 +233,7 @@ class KerasIntegrationTest(test.TestCase): verbose=2) self.assertGreater(history.history['val_acc'][-1], 0.7) - @test_util.run_deprecated_v1 + @test_util.run_v1_only('b/120545219') def test_vector_classification_shared_model(self): # Test that functional models that feature internal updates # and internal losses can be shared. diff --git a/tensorflow/python/keras/layers/lstm_test.py b/tensorflow/python/keras/layers/lstm_test.py index 3f89cc398ed..aea42615026 100644 --- a/tensorflow/python/keras/layers/lstm_test.py +++ b/tensorflow/python/keras/layers/lstm_test.py @@ -115,7 +115,7 @@ class LSTMLayerTest(test.TestCase, parameterized.TestCase): self.assertEqual(layer.cell.recurrent_kernel.constraint, r_constraint) self.assertEqual(layer.cell.bias.constraint, b_constraint) - @tf_test_util.run_deprecated_v1 + @tf_test_util.run_v1_only('b/120545219') def test_with_masking_layer_LSTM(self): layer_class = keras.layers.LSTM inputs = np.random.random((2, 3, 4)) @@ -128,7 +128,7 @@ class LSTMLayerTest(test.TestCase, parameterized.TestCase): optimizer=RMSPropOptimizer(0.01)) model.fit(inputs, targets, epochs=1, batch_size=2, verbose=1) - @tf_test_util.run_deprecated_v1 + @tf_test_util.run_v1_only('b/120545219') def test_masking_with_stacking_LSTM(self): inputs = np.random.random((2, 3, 4)) targets = np.abs(np.random.random((2, 3, 5))) @@ -314,7 +314,7 @@ class LSTMLayerTest(test.TestCase, parameterized.TestCase): class LSTMLayerGraphOnlyTest(test.TestCase): - @tf_test_util.run_deprecated_v1 + @tf_test_util.run_v1_only('b/120545219') def test_statefulness_LSTM(self): num_samples = 2 timesteps = 3 diff --git a/tensorflow/python/keras/layers/normalization_test.py b/tensorflow/python/keras/layers/normalization_test.py index 9138c0a08a3..c1acc2eb3a3 100644 --- a/tensorflow/python/keras/layers/normalization_test.py +++ b/tensorflow/python/keras/layers/normalization_test.py @@ -29,6 +29,7 @@ from tensorflow.python.training import gradient_descent @tf_test_util.run_all_in_graph_and_eager_modes +@tf_test_util.run_v1_only('b/120545219') class NormalizationLayersTest(test.TestCase): def test_basic_batchnorm(self): @@ -227,6 +228,7 @@ class NormalizationLayersTest(test.TestCase): norm(inp) +@tf_test_util.run_v1_only('b/120545219') class NormalizationLayersGraphModeOnlyTest(test.TestCase): def test_shared_batchnorm(self): @@ -301,7 +303,6 @@ class NormalizationLayersGraphModeOnlyTest(test.TestCase): x2 = model.predict(val_a) self.assertAllClose(x1, x2, atol=1e-7) - @tf_test_util.run_deprecated_v1 def test_batchnorm_trainable(self): """Tests that batchnorm layer is trainable when learning phase is enabled. diff --git a/tensorflow/python/keras/layers/simplernn_test.py b/tensorflow/python/keras/layers/simplernn_test.py index b49b159b719..bb3fea26926 100644 --- a/tensorflow/python/keras/layers/simplernn_test.py +++ b/tensorflow/python/keras/layers/simplernn_test.py @@ -98,7 +98,7 @@ class SimpleRNNLayerTest(test.TestCase): self.assertEqual(layer.cell.recurrent_kernel.constraint, r_constraint) self.assertEqual(layer.cell.bias.constraint, b_constraint) - @tf_test_util.run_deprecated_v1 + @tf_test_util.run_v1_only('b/120545219') def test_with_masking_layer_SimpleRNN(self): layer_class = keras.layers.SimpleRNN inputs = np.random.random((2, 3, 4)) @@ -121,7 +121,7 @@ class SimpleRNNLayerTest(test.TestCase): class SimpleRNNLayerGraphOnlyTest(test.TestCase): - @tf_test_util.run_deprecated_v1 + @tf_test_util.run_v1_only('b/120545219') def test_statefulness_SimpleRNN(self): num_samples = 2 timesteps = 3 diff --git a/tensorflow/python/keras/layers/unified_lstm_test.py b/tensorflow/python/keras/layers/unified_lstm_test.py index 33351948eee..932b2d331dc 100644 --- a/tensorflow/python/keras/layers/unified_lstm_test.py +++ b/tensorflow/python/keras/layers/unified_lstm_test.py @@ -56,9 +56,9 @@ _graph_options = config_pb2.GraphOptions(rewrite_options=_rewrites) _config = config_pb2.ConfigProto(graph_options=_graph_options) +@test_util.run_v1_only('b/120545219') class UnifiedLSTMTest(test.TestCase, parameterized.TestCase): - @test_util.run_deprecated_v1 def test_unifiedLSTM(self): input_shape = 10 rnn_state_size = 8 @@ -103,7 +103,6 @@ class UnifiedLSTMTest(test.TestCase, parameterized.TestCase): self.assertNotEqual(existing_loss, loss_value) existing_loss = loss_value - @test_util.run_deprecated_v1 def test_unifiedLSTM_with_cond(self): # This test is to demonstrate the graph rewrite of grappler plugin under # the condition that the function returns different number of internal @@ -692,6 +691,7 @@ class UnifiedLSTMTest(test.TestCase, parameterized.TestCase): model.train_on_batch([main_inputs] + initial_state, targets) +@test_util.run_v1_only('b/120545219') class LSTMLayerGraphOnlyTest(test.TestCase): def test_statefulness_LSTM(self): diff --git a/tensorflow/python/keras/layers/wrappers_test.py b/tensorflow/python/keras/layers/wrappers_test.py index b9196416ddd..727f33dadc8 100644 --- a/tensorflow/python/keras/layers/wrappers_test.py +++ b/tensorflow/python/keras/layers/wrappers_test.py @@ -165,6 +165,7 @@ class TimeDistributedTest(test.TestCase): y = model.predict(np.random.random((10, 3, 2))) self.assertAllClose(np.mean(y), 0., atol=1e-1, rtol=1e-1) + @tf_test_util.run_v1_only('b/120545219') def test_TimeDistributed_batchnorm(self): with self.cached_session(): # test that wrapped BN updates still work. @@ -187,6 +188,7 @@ class TimeDistributedTest(test.TestCase): # Verify input_map has one mapping from inputs to reshaped inputs. self.assertEqual(len(td._input_map.keys()), 1) + @tf_test_util.run_v1_only('b/120545219') def test_TimeDistributed_trainable(self): # test layers that need learning_phase to be set x = keras.layers.Input(shape=(3, 2)) @@ -201,7 +203,7 @@ class TimeDistributedTest(test.TestCase): assert len(layer.updates) == 2 assert len(layer.trainable_weights) == 2 - @tf_test_util.run_deprecated_v1 + @tf_test_util.run_v1_only('b/120545219') def test_TimeDistributed_with_masked_embedding_and_unspecified_shape(self): with self.cached_session(): # test with unspecified shape and Embeddings with mask_zero @@ -234,7 +236,7 @@ class TimeDistributedTest(test.TestCase): self.assertAllEqual(mask_outputs_val[i], ref_mask_val[i]) self.assertIs(mask_outputs[-1], None) # final layer - @tf_test_util.run_deprecated_v1 + @tf_test_util.run_v1_only('b/120545219') def test_TimeDistributed_with_masking_layer(self): with self.cached_session(): # test with Masking layer @@ -377,7 +379,7 @@ class BidirectionalTest(test.TestCase): model.compile(loss='mse', optimizer='sgd') model.fit(x, y, epochs=1, batch_size=1) - @tf_test_util.run_deprecated_v1 + @tf_test_util.run_v1_only('b/120545219') def test_Bidirectional_merged_value(self): rnn = keras.layers.LSTM samples = 2 @@ -508,7 +510,7 @@ class BidirectionalTest(test.TestCase): layer.trainable = True assert len(layer.trainable_weights) == 6 - @tf_test_util.run_deprecated_v1 + @tf_test_util.run_v1_only('b/120545219') def test_Bidirectional_updates(self): with self.cached_session(): x = keras.layers.Input(shape=(3, 2)) diff --git a/tensorflow/python/keras/model_subclassing_test.py b/tensorflow/python/keras/model_subclassing_test.py index 620275e50f8..553c7fb0096 100644 --- a/tensorflow/python/keras/model_subclassing_test.py +++ b/tensorflow/python/keras/model_subclassing_test.py @@ -187,6 +187,7 @@ def get_nested_model_3(input_dim, num_classes): @test_util.run_all_in_graph_and_eager_modes +@test_util.run_v1_only('b/120545219') class ModelSubclassingTest(test.TestCase): def test_custom_build(self): @@ -915,6 +916,7 @@ class ModelSubclassingTest(test.TestCase): self.assertEqual(1, len(model.get_updates_for(x))) +@test_util.run_v1_only('b/120545219') class GraphSpecificModelSubclassingTests(test.TestCase): @test_util.run_deprecated_v1 diff --git a/tensorflow/python/keras/models_test.py b/tensorflow/python/keras/models_test.py index 907ac41d0eb..c466d94fed8 100644 --- a/tensorflow/python/keras/models_test.py +++ b/tensorflow/python/keras/models_test.py @@ -69,7 +69,7 @@ def sequential_model(add_input_layer, include_input_shape=True): class TestModelCloning(test.TestCase): - @test_util.run_deprecated_v1 + @test_util.run_v1_only('b/120545219') def test_clone_sequential_model(self): with self.cached_session(): val_a = np.random.random((10, 4)) @@ -102,10 +102,9 @@ class TestModelCloning(test.TestCase): new_model.compile('rmsprop', 'mse') new_model.train_on_batch(None, val_out) - @test_util.run_deprecated_v1 + @test_util.run_v1_only('b/120545219') def test_clone_sequential_model_input_layer(self): - @test_util.run_deprecated_v1 def test_input_layer(include_inputs): with self.cached_session(): val_a = np.random.random((10, 4)) @@ -142,7 +141,7 @@ class TestModelCloning(test.TestCase): test_input_layer(True) test_input_layer(False) - @test_util.run_deprecated_v1 + @test_util.run_v1_only('b/120545219') def test_clone_functional_model(self): with self.cached_session(): val_a = np.random.random((10, 4)) @@ -318,6 +317,7 @@ class TestModelDeepCopy(test.TestCase): model_copy.get_weights()[0])) +@test_util.run_v1_only('b/120545219') class TestCloneAndBuildModel(test.TestCase): def test_clone_and_build_non_compiled_model(self): @@ -404,7 +404,6 @@ class TestCloneAndBuildModel(test.TestCase): new_model.train_on_batch(inp, out) new_model.evaluate(inp, out) - @test_util.run_deprecated_v1 def test_clone_and_build_compiled_sequential_model(self): with self.cached_session(): model = keras.models.Sequential() @@ -417,7 +416,6 @@ class TestCloneAndBuildModel(test.TestCase): self._clone_and_build_test_helper(model) - @test_util.run_deprecated_v1 def test_clone_and_build_functional_model(self): with self.cached_session(): input_a = keras.Input(shape=(4,)) @@ -434,7 +432,6 @@ class TestCloneAndBuildModel(test.TestCase): self._clone_and_build_test_helper(model) - @test_util.run_deprecated_v1 def test_clone_and_build_subclassed_model(self): class SubclassedModel(keras.Model): @@ -483,11 +480,9 @@ class TestCloneAndBuildModel(test.TestCase): def test_replace_tf_optimizer_iterations_variable(self): self.assert_optimizer_iterations_increases(adam.AdamOptimizer(0.01)) - @test_util.run_deprecated_v1 def test_replace_keras_optimizer_iterations_variable(self): self.assert_optimizer_iterations_increases('adam') - @test_util.run_deprecated_v1 def test_clone_and_build_sequential_model_without_inputs_defined(self): with self.cached_session(): model = sequential_model(False, False) diff --git a/tensorflow/python/keras/optimizers_test.py b/tensorflow/python/keras/optimizers_test.py index d3cacb702c9..77104a5d4d5 100644 --- a/tensorflow/python/keras/optimizers_test.py +++ b/tensorflow/python/keras/optimizers_test.py @@ -91,26 +91,26 @@ def _test_optimizer(optimizer, target=0.75): class KerasOptimizersTest(test.TestCase): - @test_util.run_deprecated_v1 + @test_util.run_v1_only('b/120545219') def test_sgd(self): with self.cached_session(): _test_optimizer(keras.optimizers.SGD(lr=0.01, momentum=0.9, nesterov=True)) - @test_util.run_deprecated_v1 + @test_util.run_v1_only('b/120545219') def test_rmsprop(self): with self.cached_session(): _test_optimizer(keras.optimizers.RMSprop()) _test_optimizer(keras.optimizers.RMSprop(decay=1e-3)) - @test_util.run_deprecated_v1 + @test_util.run_v1_only('b/120545219') def test_adagrad(self): with self.cached_session(): _test_optimizer(keras.optimizers.Adagrad()) _test_optimizer(keras.optimizers.Adagrad(decay=1e-3)) - @test_util.run_deprecated_v1 + @test_util.run_v1_only('b/120545219') def test_adadelta(self): with self.cached_session(): _test_optimizer(keras.optimizers.Adadelta(), target=0.6) @@ -119,32 +119,32 @@ class KerasOptimizersTest(test.TestCase): # the accuracy. _test_optimizer(keras.optimizers.Adadelta(decay=1e-3), target=0.4) - @test_util.run_deprecated_v1 + @test_util.run_v1_only('b/120545219') def test_adam(self): with self.cached_session(): _test_optimizer(keras.optimizers.Adam()) _test_optimizer(keras.optimizers.Adam(decay=1e-3)) _test_optimizer(keras.optimizers.Adam(amsgrad=True)) - @test_util.run_deprecated_v1 + @test_util.run_v1_only('b/120545219') def test_adamax(self): with self.cached_session(): _test_optimizer(keras.optimizers.Adamax()) _test_optimizer(keras.optimizers.Adamax(decay=1e-3)) - @test_util.run_deprecated_v1 + @test_util.run_v1_only('b/120545219') def test_nadam(self): with self.cached_session(): _test_optimizer(keras.optimizers.Nadam()) - @test_util.run_deprecated_v1 + @test_util.run_v1_only('b/120545219') def test_clipnorm(self): with self.cached_session(): _test_optimizer(keras.optimizers.SGD(lr=0.01, momentum=0.9, clipnorm=0.5)) - @test_util.run_deprecated_v1 + @test_util.run_v1_only('b/120545219') def test_clipvalue(self): with self.cached_session(): _test_optimizer(keras.optimizers.SGD(lr=0.01, diff --git a/tensorflow/python/kernel_tests/atrous_convolution_test.py b/tensorflow/python/kernel_tests/atrous_convolution_test.py index 6b16fca29d0..2fb8a37e2b9 100644 --- a/tensorflow/python/kernel_tests/atrous_convolution_test.py +++ b/tensorflow/python/kernel_tests/atrous_convolution_test.py @@ -110,6 +110,7 @@ class AtrousConvolutionTest(test.TestCase): add_check(check, y1, y2) + @test_util.run_v1_only("b/120545219") def test_unknown_spatial_dims_for_channel_last_format(self): x = array_ops.placeholder(dtypes.float32, [1, None, None, 10]) w = array_ops.zeros([3, 3, 10, 20]) @@ -117,6 +118,7 @@ class AtrousConvolutionTest(test.TestCase): x, w, "VALID", dilation_rate=[2, 2], data_format="NHWC") self.assertEqual(y.shape.as_list(), [1, None, None, 20]) + @test_util.run_v1_only("b/120545219") def test_unknown_spatial_dims_for_channel_first_format(self): x = array_ops.placeholder(dtypes.float32, [1, 10, None, None]) w = array_ops.zeros([3, 3, 10, 20]) @@ -262,6 +264,7 @@ class AtrousConvolutionTest(test.TestCase): err_tolerance = 1e-3 self.assertLess(err, err_tolerance) + @test_util.run_v1_only("b/120545219") def testGradient(self): with self.cached_session(): for padding in ["SAME", "VALID"]: diff --git a/tensorflow/python/kernel_tests/base64_ops_test.py b/tensorflow/python/kernel_tests/base64_ops_test.py index bb903d827f2..381f190b8df 100644 --- a/tensorflow/python/kernel_tests/base64_ops_test.py +++ b/tensorflow/python/kernel_tests/base64_ops_test.py @@ -31,6 +31,7 @@ from tensorflow.python.ops import string_ops from tensorflow.python.platform import test +@test_util.run_v1_only("b/120545219") class Base64OpsTest(test_util.TensorFlowTestCase): def setUp(self): diff --git a/tensorflow/python/kernel_tests/batch_matmul_op_test.py b/tensorflow/python/kernel_tests/batch_matmul_op_test.py index f2f0291b89c..c32a6c7e417 100644 --- a/tensorflow/python/kernel_tests/batch_matmul_op_test.py +++ b/tensorflow/python/kernel_tests/batch_matmul_op_test.py @@ -21,6 +21,7 @@ from __future__ import print_function import numpy as np from tensorflow.python import tf2 +from tensorflow.python.framework import test_util from tensorflow.python.ops import array_ops from tensorflow.python.ops import gradient_checker_v2 from tensorflow.python.ops import math_ops @@ -135,6 +136,7 @@ class BatchMatmulOpTest(test.TestCase): def _GetBatchMatmulOpTest(dtype, adjoint_a, adjoint_b, use_static_shape): + @test_util.run_v1_only("b/120545219") def Test(self): np.random.seed(42) self._testNonEmpty(dtype, adjoint_a, adjoint_b, use_static_shape) @@ -184,6 +186,7 @@ class BatchMatmulGradientTest(test.TestCase): def _GetBatchMatmulGradientTest(dtype, adjoint_a, adjoint_b): + @test_util.run_v1_only("b/120545219") def Test(self): self._compare(1, 2, 3, 5, dtype, adjoint_a, adjoint_b) self._compare(3, 4, 7, 10, dtype, adjoint_a, adjoint_b) diff --git a/tensorflow/python/kernel_tests/boosted_trees/quantile_ops_test.py b/tensorflow/python/kernel_tests/boosted_trees/quantile_ops_test.py index 390672febeb..2b9863fb89b 100644 --- a/tensorflow/python/kernel_tests/boosted_trees/quantile_ops_test.py +++ b/tensorflow/python/kernel_tests/boosted_trees/quantile_ops_test.py @@ -82,7 +82,7 @@ class QuantileOpsTest(test_util.TensorFlowTestCase): self.max_elements = 1 << 16 self.num_quantiles = constant_op.constant(3, dtype=dtypes.int64) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testBasicQuantileBucketsSingleResource(self): with self.cached_session() as sess: quantile_accumulator_handle = self.create_resource("floats", self.eps, @@ -107,7 +107,7 @@ class QuantileOpsTest(test_util.TensorFlowTestCase): self.assertAllClose(self._feature_0_quantiles, quantiles[0].eval()) self.assertAllClose(self._feature_1_quantiles, quantiles[1].eval()) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testBasicQuantileBucketsMultipleResources(self): with self.cached_session() as sess: quantile_accumulator_handle_0 = self.create_resource("float_0", self.eps, @@ -142,7 +142,7 @@ class QuantileOpsTest(test_util.TensorFlowTestCase): self.assertAllClose(self._feature_0_quantiles, quantiles[0].eval()) self.assertAllClose(self._feature_1_quantiles, quantiles[1].eval()) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testSaveRestoreAfterFlush(self): save_dir = os.path.join(self.get_temp_dir(), "save_restore") save_path = os.path.join(tempfile.mkdtemp(prefix=save_dir), "hash") @@ -175,7 +175,7 @@ class QuantileOpsTest(test_util.TensorFlowTestCase): self.assertAllClose(self._feature_0_boundaries, buckets[0].eval()) self.assertAllClose(self._feature_1_boundaries, buckets[1].eval()) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testSaveRestoreBeforeFlush(self): save_dir = os.path.join(self.get_temp_dir(), "save_restore") save_path = os.path.join(tempfile.mkdtemp(prefix=save_dir), "hash") diff --git a/tensorflow/python/kernel_tests/checkpoint_ops_test.py b/tensorflow/python/kernel_tests/checkpoint_ops_test.py index b8c8c9edb5a..6e289bf9b78 100644 --- a/tensorflow/python/kernel_tests/checkpoint_ops_test.py +++ b/tensorflow/python/kernel_tests/checkpoint_ops_test.py @@ -105,6 +105,7 @@ class GenerateVocabRemappingTest(test.TestCase): self.assertAllEqual(expected_num_present, self.evaluate(num_present)) +@test_util.run_v1_only('b/120545219') class LoadAndRemapMatrixTest(test.TestCase): """Tests for the load_and_remap_matrix() op.""" diff --git a/tensorflow/python/kernel_tests/cholesky_op_test.py b/tensorflow/python/kernel_tests/cholesky_op_test.py index f3947236b1f..a08cfe960d0 100644 --- a/tensorflow/python/kernel_tests/cholesky_op_test.py +++ b/tensorflow/python/kernel_tests/cholesky_op_test.py @@ -155,6 +155,7 @@ class CholeskyOpTest(test.TestCase): np.array([[[1., 2., 3.], [3., 4., 5.]], [[1., 2., 3.], [3., 4., 5.]] ])) + @test_util.run_v1_only("b/120545219") def testWrongDimensions(self): tensor3 = constant_op.constant([1., 2.]) with self.assertRaises(ValueError): @@ -233,6 +234,7 @@ class CholeskyGradTest(test.TestCase): self.runFiniteDifferences( shapes, dtypes=(dtypes_lib.float64,), scalarTest=True) + @test_util.run_v1_only("b/120545219") def testTwoBlockMatrixComplexFloat(self): np.random.seed(0) shapes = self.getShapes([2 * self._backprop_block_size + 1]) diff --git a/tensorflow/python/kernel_tests/cond_v2_test.py b/tensorflow/python/kernel_tests/cond_v2_test.py index 843d007cc84..8fe3ba41e27 100644 --- a/tensorflow/python/kernel_tests/cond_v2_test.py +++ b/tensorflow/python/kernel_tests/cond_v2_test.py @@ -170,6 +170,7 @@ class CondV2Test(test.TestCase): self.assertRegexpMatches( cond2_op.get_attr("else_branch").name, r"foo_cond_1_false_\d*") + @test_util.run_v1_only("b/120545219") def testDefunInCond(self): x = constant_op.constant(1.0, name="x") y = constant_op.constant(2.0, name="y") @@ -189,6 +190,7 @@ class CondV2Test(test.TestCase): self._testCond(true_fn, false_fn, [x, y]) self._testCond(true_fn, false_fn, [y]) + @test_util.run_deprecated_v1 def testNestedDefunInCond(self): x = constant_op.constant(1.0, name="x") y = constant_op.constant(2.0, name="y") @@ -213,6 +215,7 @@ class CondV2Test(test.TestCase): self._testCond(true_fn, false_fn, [x, y]) self._testCond(true_fn, false_fn, [y]) + @test_util.run_deprecated_v1 def testDoubleNestedDefunInCond(self): x = constant_op.constant(1.0, name="x") y = constant_op.constant(2.0, name="y") @@ -773,6 +776,7 @@ class CondV2Test(test.TestCase): self.assertAllEqual( self.evaluate(output_t), [-5, -4, -3, -2, -1, 0, 1, 4, 9, 16]) + @test_util.run_deprecated_v1 def testForwardPassRewrite(self): x = constant_op.constant(1.0, name="x") output = cond_v2.cond_v2(constant_op.constant(True), diff --git a/tensorflow/python/kernel_tests/conditional_accumulator_test.py b/tensorflow/python/kernel_tests/conditional_accumulator_test.py index 5847e4639bb..ce342017064 100644 --- a/tensorflow/python/kernel_tests/conditional_accumulator_test.py +++ b/tensorflow/python/kernel_tests/conditional_accumulator_test.py @@ -199,7 +199,7 @@ class ConditionalAccumulatorTest(test.TestCase): is_all_equal &= (val[i][j] == elems_ave[i][j]) self.assertTrue(is_all_equal) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testAccumulatorWrongDynamicShape(self): with self.cached_session() as sess: q = data_flow_ops.ConditionalAccumulator( @@ -321,7 +321,7 @@ class ConditionalAccumulatorTest(test.TestCase): shape=tensor_shape.TensorShape([1]), reduction_type="Invalid") - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testAccumulatorInvalidTakeGrad(self): with self.cached_session(): q = data_flow_ops.ConditionalAccumulator( @@ -435,7 +435,7 @@ class ConditionalAccumulatorTest(test.TestCase): if x >= ls) / sum(1 for x in local_steps if x >= ls), val) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testParallelApplyGrad(self): with self.cached_session() as sess: q = data_flow_ops.ConditionalAccumulator( @@ -461,7 +461,7 @@ class ConditionalAccumulatorTest(test.TestCase): self.assertEqual(val, sum(elems) / len(elems)) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testParallelTakeGrad(self): with self.cached_session() as sess: q = data_flow_ops.ConditionalAccumulator( @@ -494,7 +494,7 @@ class ConditionalAccumulatorTest(test.TestCase): self.assertItemsEqual(elems, results) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testAccumulatorApplyAndBlockingTake(self): with self.cached_session() as sess: q = data_flow_ops.ConditionalAccumulator( @@ -528,7 +528,7 @@ class ConditionalAccumulatorTest(test.TestCase): with self.assertRaisesOpError("was cancelled"): self.evaluate(takeg_op) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testAccumulatorCancel(self): with self.cached_session() as sess: q = data_flow_ops.ConditionalAccumulator( diff --git a/tensorflow/python/kernel_tests/control_flow_ops_py_test.py b/tensorflow/python/kernel_tests/control_flow_ops_py_test.py index 95420fc0f12..0fd293ebba3 100644 --- a/tensorflow/python/kernel_tests/control_flow_ops_py_test.py +++ b/tensorflow/python/kernel_tests/control_flow_ops_py_test.py @@ -129,6 +129,7 @@ def isum(s, maximum_iterations=None): @test_util.with_control_flow_v2 class ControlFlowTest(test.TestCase): + @test_util.run_v1_only("b/120545219") def testRefIdentity(self): with self.cached_session(): v = variables.VariableV1(7) @@ -141,7 +142,7 @@ class ControlFlowTest(test.TestCase): variables.global_variables_initializer().run() self.assertEqual(9, self.evaluate(v2)) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testRefEnter(self): with self.cached_session(): v = variables.VariableV1(7) @@ -155,7 +156,7 @@ class ControlFlowTest(test.TestCase): variables.global_variables_initializer().run() self.assertEqual(9, self.evaluate(v3)) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testRefSwitch(self): with self.cached_session(): v = variables.VariableV1(7) @@ -193,6 +194,7 @@ class ControlFlowTest(test.TestCase): v, "frame2", is_constant=False) self.assertEqual(enter_v_non_constant.shape, None) + @test_util.run_v1_only("b/120545219") def testSwitchMergeIndexedSlices(self): with self.cached_session(): values = constant_op.constant([1, 2, 3, 4, 5, 6]) @@ -207,6 +209,7 @@ class ControlFlowTest(test.TestCase): self.assertAllEqual(np.arange(1, 7), val) self.assertAllEqual(np.arange(0, 12, 2), ind) + @test_util.run_v1_only("b/120545219") def testSwitchDeadBranch(self): with self.cached_session(): data = constant_op.constant([1, 2, 3, 4, 5, 6], name="data") @@ -219,6 +222,7 @@ class ControlFlowTest(test.TestCase): lambda e: "Retval[0] does not have value" in str(e)): self.evaluate(dead_branch) + @test_util.run_v1_only("b/120545219") def testSwitchMergeLess(self): with self.cached_session(): data = constant_op.constant([1, 2, 3, 4, 5, 6], name="data") @@ -231,6 +235,7 @@ class ControlFlowTest(test.TestCase): result = self.evaluate(merge_op) self.assertAllEqual(np.arange(1, 7), result) + @test_util.run_v1_only("b/120545219") def testSwitchMergeAddIdentity(self): with self.cached_session(): data = constant_op.constant([1, 2, 3, 4, 5, 6], name="data") @@ -244,6 +249,7 @@ class ControlFlowTest(test.TestCase): result = self.evaluate(merge_op) self.assertAllEqual(np.array([x + 1 for x in [1, 2, 3, 4, 5, 6]]), result) + @test_util.run_v1_only("b/120545219") def testSwitchMergeAddMul(self): with self.cached_session(): data = constant_op.constant([1, 2, 3, 4, 5, 6], name="data") @@ -258,6 +264,7 @@ class ControlFlowTest(test.TestCase): result = self.evaluate(merge_op) self.assertAllEqual(np.array([x * 5 for x in [1, 2, 3, 4, 5, 6]]), result) + @test_util.run_v1_only("b/120545219") def testLoop_false(self): with self.cached_session(): false = ops.convert_to_tensor(False) @@ -302,6 +309,7 @@ class ControlFlowTest(test.TestCase): result = self.evaluate(exit_i) self.assertAllEqual(10, result) + @test_util.run_v1_only("b/120545219") def testLoop_2(self): with self.cached_session(): zero = constant_op.constant(0) @@ -328,6 +336,7 @@ class ControlFlowTest(test.TestCase): result = self.evaluate(exit_i) self.assertAllEqual(10, result) + @test_util.run_v1_only("b/120545219") def testDifferentFrame(self): with self.cached_session(): data = array_ops.placeholder(dtypes.float32, shape=[]) @@ -362,6 +371,7 @@ class ControlFlowTest(test.TestCase): lambda: math_ops.subtract(x, 1.)) self.assertEqual(b.shape, tensor_shape.scalar()) + @test_util.run_v1_only("b/120545219") def testFetchable(self): with self.cached_session() as sess: x = array_ops.placeholder(dtypes.float32) @@ -378,6 +388,7 @@ class ControlFlowTest(test.TestCase): sess.run(t, feed_dict={x: 3}) @test_util.disable_control_flow_v2("Not relevant") + @test_util.run_v1_only("b/120545219") def testFeedable(self): with self.cached_session() as sess: c = constant_op.constant(2) @@ -395,6 +406,7 @@ class ControlFlowTest(test.TestCase): with self.assertRaisesRegexp(ValueError, "may not be fed"): sess.run(r, feed_dict={t: 3}) + @test_util.run_v1_only("b/120545219") def testCondIndexedSlices(self): with self.cached_session(): values = constant_op.constant(10) @@ -410,6 +422,7 @@ class ControlFlowTest(test.TestCase): self.assertAllEqual(11, val) self.assertAllEqual(0, ind) + @test_util.run_v1_only("b/120545219") def testCondSparseTensor(self): with self.cached_session(): values = constant_op.constant([2.0, 4.0], name="values") @@ -427,6 +440,7 @@ class ControlFlowTest(test.TestCase): self.assertAllEqual([[1], [4]], r.indices.eval()) self.assertAllEqual(r.values.get_shape(), (2,)) + @test_util.run_v1_only("b/120545219") def testCondResource(self): with self.cached_session(): @@ -441,6 +455,7 @@ class ControlFlowTest(test.TestCase): self.assertEqual(1.0, control_flow_ops.cond(rv, case, lambda: t).eval()) + @test_util.run_v1_only("b/120545219") def testCondWithTensorArrayGrad(self): with self.cached_session() as sess: with ops.device(test.gpu_device_name()): @@ -455,6 +470,7 @@ class ControlFlowTest(test.TestCase): self.assertAllEqual(sess.run(g, {pred: False}), [0.0, 0.0, 0.0]) @test_util.disable_control_flow_v2("b/113293074") + @test_util.run_v1_only("b/120545219") def testCondIndexedSlicesDifferentTypes(self): with self.cached_session(): values = constant_op.constant(10) @@ -472,6 +488,7 @@ class ControlFlowTest(test.TestCase): self.assertAllEqual(0, ind) self.assertTrue(ind.dtype == np.int64) + @test_util.run_v1_only("b/120545219") def testCondColocation(self): with self.session(use_gpu=True): with ops.device("/cpu:0"): @@ -576,6 +593,7 @@ class ControlFlowTest(test.TestCase): alive, count = body(i) self.assertAllEqual(4, self.evaluate(count)) + @test_util.run_v1_only("b/120545219") def testCond_6(self): with self.cached_session(): v1 = variables.Variable([7]) @@ -671,6 +689,7 @@ class ControlFlowTest(test.TestCase): test_result = self.evaluate(r) self.assertDictEqual({"a": {"c": 210}, "b": {"d": 210}}, test_result) + @test_util.run_v1_only("b/120545219") def testCheckNestedOutputStruct(self): with self.cached_session() as sess: x = constant_op.constant(10) @@ -701,7 +720,7 @@ class ControlFlowTest(test.TestCase): self.assertAllEqual([2.0], self.evaluate(r)) @test_util.disable_control_flow_v2("b/79881896 (control deps)") - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testCondWithControl(self): with self.cached_session(): control_holder = array_ops.placeholder(dtypes.float32, shape=()) @@ -717,6 +736,7 @@ class ControlFlowTest(test.TestCase): lambda: constant_op.constant(1)) self.assertEqual(5, self.evaluate(r)) + @test_util.run_v1_only("b/120545219") def testUninitializedRefIdentity(self): with self.cached_session() as sess: v = gen_state_ops.variable( @@ -771,6 +791,7 @@ class ControlFlowTest(test.TestCase): r = control_flow_ops.cond(pred, fn1, fn2) self.evaluate(r) + @test_util.run_v1_only("b/120545219") def testCondGrad_1(self): with self.cached_session(): x = constant_op.constant(10.0, name="x") @@ -845,6 +866,7 @@ class ControlFlowTest(test.TestCase): self.assertEqual(sess.run(grad_grad, {pred: True, x: 1.0, y: 2.0}), 0.0) self.assertEqual(sess.run(grad_grad, {pred: False, x: 1.0, y: 2.0}), 0.0) + @test_util.run_v1_only("b/120545219") def testNestedCond_Simple(self): with self.cached_session(): x = constant_op.constant(0., name="X") @@ -861,7 +883,7 @@ class ControlFlowTest(test.TestCase): self.assertEqual(1.0, self.evaluate(result)) @test_util.disable_control_flow_v2("b/113327884") - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testCondGrad_Gather(self): with self.cached_session() as sess: v1 = variables.Variable([1.0, 42.0]) @@ -885,6 +907,7 @@ class ControlFlowTest(test.TestCase): ] self.assertAllEqual(dense_gv, [0.0, 2.0]) + @test_util.run_v1_only("b/120545219") def testCondPredicateTensor(self): """Regression test for lowering predicate from non-first output of an op.""" @@ -1011,6 +1034,7 @@ class ControlFlowTest(test.TestCase): self.assertEqual(10000, self.evaluate(r)) @test_util.disable_control_flow_v2("b/79881896 (control deps)") + @test_util.run_v1_only("b/120545219") def testWhileExternalControlDependencies(self): with self.cached_session(): v = variables.Variable(0.0) @@ -1027,6 +1051,7 @@ class ControlFlowTest(test.TestCase): self.assertAllEqual(v.eval(), 1.0) @test_util.disable_control_flow_v2("b/79881896 (control deps)") + @test_util.run_v1_only("b/120545219") def testWhileExternalControlDependenciesNoInput(self): with self.cached_session(): v = variables.Variable(0.0) @@ -1043,7 +1068,7 @@ class ControlFlowTest(test.TestCase): self.assertAllEqual(v.eval(), 1.0) @test_util.disable_control_flow_v2("b/113324949 (RefVariable)") - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testWhileWithRefs_1(self): with self.cached_session() as sess: x = variables.VariableV1(0)._ref() # pylint: disable=protected-access @@ -1080,6 +1105,7 @@ class ControlFlowTest(test.TestCase): r = isum(s, maximum_iterations=3) self.assertAllEqual([1 + 3, 2 + 3, 3 + 3, 4 + 3, 5 + 3], self.evaluate(r)) + @test_util.run_v1_only("b/120545219") def testWhileWithMaximumIterationsAndSingleArgument(self): with self.cached_session(): r = control_flow_ops.while_loop( @@ -1087,6 +1113,7 @@ class ControlFlowTest(test.TestCase): self.assertEqual(1, self.evaluate(r)) @test_util.disable_control_flow_v2("b/115776323 (max_iters)") + @test_util.run_v1_only("b/120545219") def testSingleNestedMaximumIterationsWhileLoopGradientInXLAContext(self): v = constant_op.constant(1.0) @@ -1112,6 +1139,7 @@ class ControlFlowTest(test.TestCase): # Should execute without issue. self.assertEqual(3, self.evaluate(loop_execute)) + @test_util.run_v1_only("b/120545219") def testInvalidMaximumIterationsWhileLoopGradientInXLAContext(self): v = constant_op.constant(1.0) @@ -1172,6 +1200,7 @@ class ControlFlowTest(test.TestCase): r"context '.*' \(currently defined in '.*'\)"): _ = gradients_impl.gradients(loop_with_maxiter, v) + @test_util.run_v1_only("b/120545219") def testInvalidMaximumIterationsFromSiblingContextWhileLoopInXLAContext(self): v = constant_op.constant(1.0) @@ -1215,6 +1244,7 @@ class ControlFlowTest(test.TestCase): _ = gradients_impl.gradients(loop, v) @test_util.disable_control_flow_v2("b/118457764") + @test_util.run_v1_only("b/120545219") def testNestedWhileLoopWithMaxItersFromOuterContextInXLAContext(self): v = constant_op.constant(1.0) @@ -1326,6 +1356,7 @@ class ControlFlowTest(test.TestCase): result = r[3].eval() self.assertAllEqual(42, result) + @test_util.run_v1_only("b/120545219") def testWhile_5(self): with self.cached_session(): @@ -1351,6 +1382,7 @@ class ControlFlowTest(test.TestCase): self.assertAllEqual(np.array([0, 1, 2, 3, 4, 5, 6]), result) @test_util.disable_control_flow_v2("b/116338794 (buffer_reuse)") + @test_util.run_v1_only("b/120545219") def testBufferForwarding(self): run_options = config_pb2.RunOptions( trace_level=config_pb2.RunOptions.FULL_TRACE) @@ -1435,6 +1467,7 @@ class ControlFlowTest(test.TestCase): r = control_flow_ops.while_loop(c, b, [n], parallel_iterations=20) self.assertEqual([10000], self.evaluate(r)) + @test_util.run_v1_only("b/120545219") def testWhileShapeInference(self): with self.cached_session(): i = constant_op.constant(0) @@ -1461,6 +1494,7 @@ class ControlFlowTest(test.TestCase): r = control_flow_ops.while_loop(c, b, [i, m]) @test_util.disable_control_flow_v2("b/116328420 (SparseTensor)") + @test_util.run_v1_only("b/120545219") def testWhileShapeInferenceSparseTensor(self): with self.cached_session(): values = constant_op.constant([2.0, 4.0], name="values") @@ -1493,7 +1527,7 @@ class ControlFlowTest(test.TestCase): [i.get_shape(), tensor_shape.TensorShape([5])]) @test_util.disable_control_flow_v2("b/116282023 (IndexedSlices)") - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testWhileShapeInferenceIndexedSlices(self): with self.cached_session(): values = constant_op.constant([[2.0, 4.0], [3.0, 5.0]], name="values") @@ -1584,6 +1618,7 @@ class ControlFlowTest(test.TestCase): self._testNestedWhile_2(use_gpu=False) self._testNestedWhile_2(use_gpu=True) + @test_util.run_v1_only("b/120545219") def testWhileWithControl_1(self): with self.cached_session(): n = constant_op.constant(0) @@ -1615,6 +1650,7 @@ class ControlFlowTest(test.TestCase): condition, body, [r], parallel_iterations=1) self.assertAllEqual(12, self.evaluate(res)) + @test_util.run_v1_only("b/120545219") def testWhileWithControl_3(self): with self.cached_session() as sess: b = array_ops.placeholder(dtypes.bool) @@ -1624,6 +1660,7 @@ class ControlFlowTest(test.TestCase): r = control_flow_ops.while_loop(lambda x: x < 10, lambda x: x + c, [x0]) self.assertEqual(10, sess.run(r, {b: True})) + @test_util.run_v1_only("b/120545219") def testWhileWithControl_4(self): with self.cached_session() as sess: b = array_ops.placeholder(dtypes.bool) @@ -1635,6 +1672,7 @@ class ControlFlowTest(test.TestCase): self.assertEqual(10, sess.run(r, {b: True})) @test_util.disable_control_flow_v2("b/79881896 (control_deps)") + @test_util.run_v1_only("b/120545219") def testWhileWithControl_5(self): with self.cached_session() as sess: b = array_ops.placeholder(dtypes.bool) @@ -1663,6 +1701,7 @@ class ControlFlowTest(test.TestCase): self.assertEqual(0, self.evaluate(loop)) @test_util.disable_control_flow_v2("b/113324949 (ref vars)") + @test_util.run_v1_only("b/120545219") def testWhileCondWithControl_1(self): with self.cached_session(): v = variable_scope.get_variable( @@ -1686,6 +1725,7 @@ class ControlFlowTest(test.TestCase): self.assertAllClose(65536.0, self.evaluate(v)) @test_util.disable_control_flow_v2("b/113324949 (ref vars)") + @test_util.run_v1_only("b/120545219") def testWhileCondExitControl(self): with self.cached_session(): @@ -1855,6 +1895,7 @@ class ControlFlowTest(test.TestCase): self.assertAllClose(np.array([10.0, 10.0, 10.0]), result) @test_util.disable_control_flow_v2("b/113324949 (RefVariable)") + @test_util.run_v1_only("b/120545219") def testWhileUpdateVariable_2(self): with self.cached_session(): select1 = variables.Variable([3.0, 4.0, 5.0]) @@ -1905,7 +1946,7 @@ class ControlFlowTest(test.TestCase): self.assertAllClose(np.array([10.0, 10.0, 10.0]), result) @test_util.disable_control_flow_v2("b/113324949 (RefVariable)") - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testWhileUpdateVariable_4(self): with self.cached_session(): var_a = variables.Variable(0, name="a") @@ -1934,7 +1975,7 @@ class ControlFlowTest(test.TestCase): self.assertEqual(10, self.evaluate(var_b)) @test_util.disable_control_flow_v2("b/113324949 (RefVariable)") - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testWhileUpdateVariable_5(self): with self.cached_session(): # Create some variables. @@ -1965,6 +2006,7 @@ class ControlFlowTest(test.TestCase): self.assertEqual(10, self.evaluate(var_b)) @test_util.disable_control_flow_v2("b/113324949 (RefVariable)") + @test_util.run_v1_only("b/120545219") def testWhileUpdateVariable_6(self): with self.cached_session(): # Create some variables. @@ -1994,6 +2036,7 @@ class ControlFlowTest(test.TestCase): self.assertEqual(55, self.evaluate(var_b)) self.assertEqual(10, self.evaluate(var_a)) + @test_util.run_v1_only("b/120545219") def testWhileQueue_1(self): with self.cached_session(): q = data_flow_ops.FIFOQueue(-1, dtypes.int32) @@ -2012,6 +2055,7 @@ class ControlFlowTest(test.TestCase): for i in xrange(10): self.assertEqual([i], q.dequeue().eval()) + @test_util.run_v1_only("b/120545219") def testWhileTimeOut(self): run_options = config_pb2.RunOptions(timeout_in_ms=1) with self.cached_session() as sess: @@ -2023,6 +2067,7 @@ class ControlFlowTest(test.TestCase): sess.run(r, options=run_options) @test_util.disable_control_flow_v2("b/117119329 (stack)") + @test_util.run_v1_only("b/120545219") def testWhileStack_1(self): with self.cached_session(): s = gen_data_flow_ops.stack_v2(-1, dtypes.int32, stack_name="foo") @@ -2092,10 +2137,12 @@ class ControlFlowTest(test.TestCase): self.assertAllClose(1024.0, self.evaluate(r)) @test_util.disable_control_flow_v2("b/116351701 (colocation)") + @test_util.run_v1_only("b/120545219") def testWhileGrad_ColocateGradients(self): self._testWhileGrad_ColocateGradients(colocate=False) self._testWhileGrad_ColocateGradients(colocate=True) + @test_util.run_v1_only("b/120545219") def testWhileGrad_Square(self): with self.cached_session(): v = constant_op.constant(2.0, name="v") @@ -2107,6 +2154,7 @@ class ControlFlowTest(test.TestCase): r = gradients_impl.gradients(r, v)[0] self.assertAllClose(1024.0, self.evaluate(r)) + @test_util.run_v1_only("b/120545219") def testWhileGrad_Shape(self): with self.cached_session(): x = array_ops.placeholder(dtypes.float32, shape=[None]) @@ -2137,6 +2185,7 @@ class ControlFlowTest(test.TestCase): r = gradients_impl.gradients([r, y], x)[0] self.assertAllClose([2.0, 4.0], sess.run(r, feed_dict={x: [1.0, 2.0]})) + @test_util.run_v1_only("b/120545219") def testWhileGrad_MultipleUses(self): with self.cached_session(): v = constant_op.constant(2.0, name="v") @@ -2148,6 +2197,7 @@ class ControlFlowTest(test.TestCase): r = gradients_impl.gradients(r, v)[0] self.assertEqual(524288.0, self.evaluate(r)) + @test_util.run_v1_only("b/120545219") def testWhileGrad_LoopAdd(self): with self.cached_session(): v = constant_op.constant(2.0, name="v") @@ -2211,6 +2261,7 @@ class ControlFlowTest(test.TestCase): def testNestedWhileCondWhileGradGpu(self): self._testNestedWhileCondWhileGrad(use_gpu=True) + @test_util.run_v1_only("b/120545219") def testWhileGrad_Variable(self): with self.cached_session(): a = variables.Variable(3.0) @@ -2236,6 +2287,7 @@ class ControlFlowTest(test.TestCase): variables.global_variables_initializer().run() self.assertAllClose(216.0, g[0].eval()) + @test_util.run_v1_only("b/120545219") def testWhileGradInCond(self): with self.cached_session(): @@ -2253,7 +2305,7 @@ class ControlFlowTest(test.TestCase): self.assertAllClose(9.0, r.eval(feed_dict={x: 1.0})) @test_util.disable_control_flow_v2("b/116340060") - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testGradInWhileWrtInitialLoopVal(self): with self.cached_session(): x = array_ops.placeholder(dtypes.float32, shape=(), name="x") @@ -2271,6 +2323,7 @@ class ControlFlowTest(test.TestCase): "loop invariants or wrt the input parameters to the loop body."): control_flow_ops.while_loop(lambda i, x: i < 3, body, [0, y]) + @test_util.run_v1_only("b/120545219") def testWhileGradInWhile(self): with self.cached_session(): n = ops.convert_to_tensor(1.0, name="n") @@ -2287,6 +2340,7 @@ class ControlFlowTest(test.TestCase): [tensor_shape.unknown_shape()]) self.assertAllClose(9.0, r.eval(feed_dict={x: 1.0})) + @test_util.run_v1_only("b/120545219") def testCondGradInNestedWhiles(self): def outer_body(i, x): @@ -2375,6 +2429,7 @@ class ControlFlowTest(test.TestCase): self.assertEqual([100.0, 1.0, 102.0, 3.0, 4.0 + 100 * 2.0], self.evaluate(r_flattened)) + @test_util.run_v1_only("b/120545219") def testWhile_NestedBadArityFails(self): with self.cached_session(): named = collections.namedtuple("named", ("a", "b")) @@ -2391,6 +2446,7 @@ class ControlFlowTest(test.TestCase): with self.assertRaisesRegexp(ValueError, "the same number of elements"): control_flow_ops.while_loop(c, b, loop_vars) + @test_util.run_v1_only("b/120545219") def testWhileGrad_ys_xs(self): with self.cached_session(): x = constant_op.constant(3.0, name="x") @@ -2435,6 +2491,7 @@ class ControlFlowTest(test.TestCase): self.assertAllClose(1024.0, r[0].eval()) @test_util.disable_control_flow_v2("b/116355153 (back_prop flag)") + @test_util.run_v1_only("b/120545219") def testWhileGrad_NoGradient(self): with self.cached_session(): v = constant_op.constant(2.0, name="v") @@ -2446,6 +2503,7 @@ class ControlFlowTest(test.TestCase): self.assertAllClose(1.0, r[0].eval()) @test_util.disable_control_flow_v2("b/113324949 (RefVariable)") + @test_util.run_v1_only("b/120545219") def testWhileGrad_NoDependency(self): with self.cached_session() as sess: variable = variables.Variable(array_ops.ones([2, 3])) @@ -2486,6 +2544,7 @@ class ControlFlowTest(test.TestCase): grad = gradients_impl.gradients(cost, [c0]) self.assertAllClose(0.0, sess.run(grad[0])) + @test_util.run_v1_only("b/120545219") def testWhileGrad_SerialTwoLoops(self): with self.cached_session(): i = constant_op.constant(0, name="i") @@ -2504,6 +2563,7 @@ class ControlFlowTest(test.TestCase): r = gradients_impl.gradients([rx], x) self.assertAllClose(1024.0, r[0].eval()) + @test_util.run_v1_only("b/120545219") def testWhileGrad_ParallelTwoLoops(self): with self.cached_session(): i = constant_op.constant(0, name="i") @@ -2523,6 +2583,7 @@ class ControlFlowTest(test.TestCase): r = gradients_impl.gradients([rx], x) self.assertAllClose(64.0, r[0].eval()) + @test_util.run_v1_only("b/120545219") def testWhileGrad_OneOutputWithControlDependencyOnSecond(self): with self.cached_session(): i = constant_op.constant(0, name="i") @@ -2566,6 +2627,7 @@ class ControlFlowTest(test.TestCase): self._testNestedWhileGrad_Simple(use_gpu=False) self._testNestedWhileGrad_Simple(use_gpu=True) + @test_util.run_v1_only("b/120545219") def testNestedWhileGrad_SerialInner(self): with self.cached_session(): v = constant_op.constant(1.0) @@ -2613,6 +2675,7 @@ class ControlFlowTest(test.TestCase): r = gradients_impl.gradients(r, v)[0] self.assertAllClose(512.0, self.evaluate(r)) + @test_util.run_v1_only("b/120545219") def testNestedWhileGrad_ParallelIterations(self): # Make sure the stack pushes and pops of an inner loop are executed in # the sequential order of the iterations of its outer loop. @@ -2702,6 +2765,7 @@ class ControlFlowTest(test.TestCase): self.assertAllClose([[0.98000002, 1.98000002]], self.evaluate(x)) @test_util.disable_control_flow_v2("b/113324949 (RefVariable)") + @test_util.run_v1_only("b/120545219") def testWhileWithRefsWithGradients_1(self): with self.cached_session() as sess: x = variables.VariableV1(0.)._ref() # pylint: disable=protected-access @@ -2731,6 +2795,7 @@ class ControlFlowTest(test.TestCase): self.assertEqual(73, value_x_grad) @test_util.disable_control_flow_v2("b/116282023 (IndexedSlices)") + @test_util.run_v1_only("b/120545219") def testWhileGrad_IndexedSlices(self): with self.cached_session(): values = constant_op.constant([2.0, 4.0], name="values") @@ -2753,7 +2818,7 @@ class ControlFlowTest(test.TestCase): self.assertAllClose(np.array([1024.0, 1024.0]), self.evaluate(r)) @test_util.disable_control_flow_v2("b/116328420 (SparseTensor)") - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testWhileGrad_SparseTensor(self): with self.cached_session(): values = constant_op.constant([2.0, 4.0], name="values") @@ -2777,6 +2842,7 @@ class ControlFlowTest(test.TestCase): self.assertAllClose(np.array([1024.0, 1024.0]), self.evaluate(r)) @test_util.disable_control_flow_v2("b/115920078 (gradients)") + @test_util.run_v1_only("b/120545219") def testCallGradInLoop(self): with self.cached_session() as sess: i0 = constant_op.constant(0) @@ -2959,6 +3025,7 @@ class ControlFlowTest(test.TestCase): self.assertAllClose([0., 0.], self.evaluate(dy_dq)) @test_util.disable_control_flow_v2("b/113324949 (RefVariable)") + @test_util.run_v1_only("b/120545219") def testWhileGradientWithNontrainablePath2(self): q = variables.Variable([7., 8.]) @@ -2977,6 +3044,7 @@ class ControlFlowTest(test.TestCase): self.assertAllClose([1., 1.], self.evaluate(dy_dq)) @test_util.disable_control_flow_v2("b/115920078 (gradients)") + @test_util.run_v1_only("b/120545219") def testIssue16504(self): c = constant_op.constant(np.arange(100), dtype=dtypes.float32) w = variables.Variable( @@ -3000,6 +3068,7 @@ class ControlFlowTest(test.TestCase): grad, = gradients_impl.gradients(w, c) self.assertIsNotNone(grad) + @test_util.run_v1_only("b/120545219") def testStopGradMultiFlows(self): with self.cached_session(): @@ -3026,6 +3095,7 @@ class ControlFlowTest(test.TestCase): variables.global_variables_initializer().run() self.assertEqual(5.0, self.evaluate(result)) + @test_util.run_v1_only("b/120545219") def testOneValueCond(self): with self.cached_session(): @@ -3059,6 +3129,7 @@ class ControlFlowTest(test.TestCase): self.assertAllClose(4.0, i.eval(feed_dict={d: 1})) self.assertAllClose(2.0 * math.sqrt(2), i.eval(feed_dict={d: 2})) + @test_util.run_v1_only("b/120545219") def testCase(self): with self.cached_session(): x = constant_op.constant(1) @@ -3111,6 +3182,7 @@ class ControlFlowTest(test.TestCase): self.assertAllEqual(r6.eval(), 0) + @test_util.run_v1_only("b/120545219") def testCaseSideEffects(self): with self.cached_session() as sess: v0 = variables.Variable(-1) @@ -3147,6 +3219,7 @@ class ControlFlowTest(test.TestCase): self.assertAllEqual(self.evaluate([v0, v1, v2]), [0, -1, -1]) @test_util.disable_control_flow_v2("b/113324949 (ref vars)") + @test_util.run_v1_only("b/120545219") def testOneOpCond(self): with self.cached_session(): v = variables.Variable(0) @@ -3175,6 +3248,7 @@ class ControlFlowTest(test.TestCase): self.assertEqual(2, i.eval(feed_dict={c.name: 0})) self.assertEqual(2, self.evaluate(v)) + @test_util.run_v1_only("b/120545219") def testWithOpsDependencies(self): with self.cached_session() as sess: v = variables.VariableV1(0.0) @@ -3198,6 +3272,7 @@ class ControlFlowTest(test.TestCase): # Ensure that 'v' is initialized self.assertAllClose(0.0, real_v_val) + @test_util.run_v1_only("b/120545219") def testWithTensorDependencies(self): with self.cached_session(): v = variables.VariableV1(0.0) @@ -3224,6 +3299,7 @@ class ControlFlowTest(test.TestCase): # Ensure that 'v' is initialized self.assertAllClose(0.0, self.evaluate(v)) + @test_util.run_v1_only("b/120545219") def testWithIndexedSlicesDependencies(self): with self.cached_session(): v = variables.VariableV1( @@ -3270,6 +3346,7 @@ class ControlFlowTest(test.TestCase): self.assertDeviceEqual("", with_vdef_dep.device) self.assertEqual([b"loc:@vdef"], with_vdef_dep.op.colocation_groups()) + @test_util.run_v1_only("b/120545219") def testGroup(self): with self.cached_session() as sess: v1 = variables.VariableV1([0.0]) @@ -3289,6 +3366,7 @@ class ControlFlowTest(test.TestCase): self.assertAllClose([0.0], v1_val) self.assertAllClose([1.0], v2_val) + @test_util.run_v1_only("b/120545219") def testGroupEmpty(self): op = control_flow_ops.group() self.assertEqual(op.type, "NoOp") @@ -3349,7 +3427,7 @@ class ControlFlowTest(test.TestCase): self.assertEqual([None, None], m.get_shape().as_list()) self.assertEqual([], index.get_shape()) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testRefSelect(self): index = array_ops.placeholder(dtypes.int32) @@ -3404,6 +3482,7 @@ class ControlFlowTest(test.TestCase): with self.assertRaises(ValueError): sess.run(tensor_list[0]) + @test_util.run_v1_only("b/120545219") def testWhilePyFuncBasic(self): def func(x): @@ -3417,6 +3496,7 @@ class ControlFlowTest(test.TestCase): [tensor_shape.unknown_shape(), tensor_shape.unknown_shape()]) self.assertEqual(r[1].eval(), 65536.0) + @test_util.run_v1_only("b/120545219") def testWhileFuncBasic(self): @function.Defun(dtypes.float32) @@ -3440,6 +3520,7 @@ class ControlFlowTest(test.TestCase): ]), 1) + @test_util.run_v1_only("b/120545219") def testQIntSwitchMerge(self): with self.cached_session(force_gpu=test.is_gpu_available()) as sess: constant_qint = constant_op.constant(np.array([42]), dtypes.qint8) @@ -3448,6 +3529,7 @@ class ControlFlowTest(test.TestCase): result = control_flow_ops.merge([v_f, v_t]) self.evaluate(result) + @test_util.run_v1_only("b/120545219") def testQIntRefSwitchMerge(self): with self.cached_session(use_gpu=test.is_gpu_available()) as sess: var_qint = gen_state_ops.variable( @@ -3461,6 +3543,7 @@ class ControlFlowTest(test.TestCase): result = control_flow_ops.ref_merge([v_f, v_t]) self.evaluate(result) + @test_util.run_v1_only("b/120545219") def testUInt64SwitchMerge(self): with self.cached_session(force_gpu=test.is_gpu_available()) as sess: constant_uint64 = constant_op.constant(np.array([42]), dtypes.uint64) @@ -3508,6 +3591,7 @@ class ControlFlowContextCheckTest(test.TestCase): math_ops.less(1, 2), true_fn, lambda: constant_op.constant(0)) return cond_tensor[0] + @test_util.run_v1_only("b/120545219") def testInvalidContext(self): # Accessing a while loop tensor outside of control flow is illegal. while_tensor = self._getWhileTensor() @@ -3517,7 +3601,7 @@ class ControlFlowContextCheckTest(test.TestCase): "is in a while loop. See info log for more details."): math_ops.add(1, while_tensor) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testInvalidContextInCond(self): # Accessing a while loop tensor in cond is illegal. while_tensor = self._getWhileTensor() @@ -3530,6 +3614,7 @@ class ControlFlowContextCheckTest(test.TestCase): math_ops.less(1, 2), lambda: math_ops.add(1, while_tensor), lambda: constant_op.constant(0)) + @test_util.run_v1_only("b/120545219") def testInvalidContextInWhile(self): # Accessing a while loop tensor in a different while loop is illegal. while_tensor = self._getWhileTensor() @@ -3564,6 +3649,7 @@ class ControlFlowContextCheckTest(test.TestCase): control_flow_ops.cond(math_ops.less(1, 2), branch_fn, branch_fn) + @test_util.run_v1_only("b/120545219") def testValidWhileContext(self): # Accessing a tensor in a nested while is OK. def body(_): @@ -3572,6 +3658,7 @@ class ControlFlowContextCheckTest(test.TestCase): control_flow_ops.while_loop(lambda i: i < 5, body, [0]) + @test_util.run_v1_only("b/120545219") def testValidNestedContexts(self): # Accessing a tensor from a cond context in a while context, all inside an # outer while context, is OK. @@ -3586,7 +3673,7 @@ class ControlFlowContextCheckTest(test.TestCase): control_flow_ops.while_loop(lambda i: i < 5, body, [0]) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testInvalidNestedContexts(self): # Accessing a tensor from a while context in a different while context, all # inside a cond context, is illegal. @@ -3605,6 +3692,7 @@ class ControlFlowContextCheckTest(test.TestCase): class TupleTest(test.TestCase): + @test_util.run_v1_only("b/120545219") def testTensors(self): for v1_first in [True, False]: with self.cached_session(): @@ -3635,7 +3723,7 @@ class TupleTest(test.TestCase): self.assertAllClose([30.0], self.evaluate(t2)) self.assertAllClose([1.0], self.evaluate(v1)) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testIndexedSlices(self): for v1_first in [True, False]: with self.cached_session(): @@ -3887,6 +3975,7 @@ class EagerTest(test.TestCase): isum(tensor, maximum_iterations=3).numpy(), [1 + 3, 2 + 3, 3 + 3, 4 + 3, 5 + 3]) + @test_util.run_v1_only("b/120545219") def testWhileWithMaximumIterationsAndSingleArgument(self): with context.eager_mode(): tensor = constant_op.constant(0) @@ -3909,6 +3998,7 @@ class EagerTest(test.TestCase): self.assertAllEqual(t1.numpy(), tup1.numpy()) self.assertAllEqual(t2.numpy(), tup2.numpy()) + @test_util.run_v1_only("b/120545219") def testCase(self): with context.eager_mode(): x = constant_op.constant(1) diff --git a/tensorflow/python/kernel_tests/control_flow_util_test.py b/tensorflow/python/kernel_tests/control_flow_util_test.py index 762c445da05..573f4b0d250 100644 --- a/tensorflow/python/kernel_tests/control_flow_util_test.py +++ b/tensorflow/python/kernel_tests/control_flow_util_test.py @@ -22,6 +22,7 @@ from __future__ import print_function from tensorflow.python.framework import dtypes from tensorflow.python.framework import ops from tensorflow.python.framework import test_ops +from tensorflow.python.framework import test_util from tensorflow.python.ops import array_ops from tensorflow.python.ops import control_flow_ops from tensorflow.python.ops import control_flow_util @@ -32,6 +33,7 @@ from tensorflow.python.platform import test class ControlFlowUtilTest(test.TestCase): + @test_util.run_v1_only("b/120545219") def testIsSwitch(self): switch_false, _ = control_flow_ops.switch(1, True) switch = switch_false.op @@ -44,6 +46,7 @@ class ControlFlowUtilTest(test.TestCase): self.assertFalse(control_flow_util.IsSwitch(test_ops.int_output().op)) + @test_util.run_v1_only("b/120545219") def testIsLoopEnter(self): enter = gen_control_flow_ops.enter(1, frame_name="name").op self.assertTrue(control_flow_util.IsLoopEnter(enter)) @@ -61,6 +64,7 @@ class ControlFlowUtilTest(test.TestCase): self.assertFalse(control_flow_util.IsLoopEnter(test_ops.int_output().op)) + @test_util.run_v1_only("b/120545219") def testIsLoopExit(self): exit_op = control_flow_ops.exit(1).op self.assertTrue(control_flow_util.IsLoopExit(exit_op)) diff --git a/tensorflow/python/kernel_tests/ctc_loss_op_test.py b/tensorflow/python/kernel_tests/ctc_loss_op_test.py index e6b5835079e..e24f304c1b8 100644 --- a/tensorflow/python/kernel_tests/ctc_loss_op_test.py +++ b/tensorflow/python/kernel_tests/ctc_loss_op_test.py @@ -106,7 +106,7 @@ class CTCLossTest(test.TestCase): with self.assertRaisesOpError(expected_err_re): self.evaluate([loss, grad]) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testBasic(self): """Test two batch entries.""" # Input and ground truth from Alex Graves' implementation. @@ -242,7 +242,7 @@ class CTCLossTest(test.TestCase): self._testCTCLoss(inputs, seq_lens, labels, loss_truth, grad_truth) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def test_time_major(self): """Testing time_major param. @@ -272,7 +272,7 @@ class CTCLossTest(test.TestCase): (tf_loss, tf_loss_transposed) = self.evaluate([loss, loss_transposed]) self.assertAllEqual(tf_loss, tf_loss_transposed) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testInvalidSecondGradient(self): inputs = np.random.randn(2, 2, 3).astype(np.float32) inputs_t = constant_op.constant(inputs) @@ -289,7 +289,7 @@ class CTCLossTest(test.TestCase): "explicitly disabled"): _ = gradients_impl._hessian_vector_product(loss, [inputs_t], v) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testEmptyBatch(self): inputs = constant_op.constant([], dtype=dtypes.float32, shape=(1, 0, 2)) sequence_lengths = constant_op.constant([], dtype=dtypes.int32) @@ -306,7 +306,7 @@ class CTCLossTest(test.TestCase): class CTCLossTestV2(test.TestCase): - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testCtcLossV2(self): random_seed.set_random_seed(5) @@ -351,7 +351,7 @@ class CTCLossTestV2(test.TestCase): logit_length=logit_length, blank_index=0)) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testCtcLossDenseIsSameAsCtcLoss(self): with ops.device("/GPU:0" if test.is_gpu_available() else "/CPU:0"): random_seed.set_random_seed(5) @@ -405,7 +405,7 @@ class CTCLossTestV2(test.TestCase): rtol=2e-06, atol=2e-06) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testCtcLossDenseUniqueFastPathIsSameAsCtcLoss(self): random_seed.set_random_seed(5) @@ -459,7 +459,7 @@ class CTCLossTestV2(test.TestCase): rtol=2e-06, atol=2e-06) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testCtcLossDenseWithBlankIndexIsSameAsCtcLoss(self): random_seed.set_random_seed(5) @@ -516,7 +516,7 @@ class CTCLossTestV2(test.TestCase): rtol=2e-06, atol=2e-06) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testCtcLossDenseWithNegativeBlankIndexIsSameAsCtcLoss(self): with ops.device("/GPU:0" if test.is_gpu_available() else "/CPU:0"): random_seed.set_random_seed(5) @@ -565,7 +565,7 @@ class CTCLossTestV2(test.TestCase): rtol=2e-06, atol=2e-06) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testCollapseRepeated(self): collapsed, new_seq_lengths = ctc_ops.collapse_repeated( labels=[[1, 3, 3, 3, 0], @@ -579,7 +579,7 @@ class CTCLossTestV2(test.TestCase): [1, 4, 0, 0], [4, 2, 9, 4]]) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testCollapseRepeatedPreservesDtypes(self): collapsed, new_seq_lengths = ctc_ops.collapse_repeated( labels=constant_op.constant( @@ -597,7 +597,7 @@ class CTCLossTestV2(test.TestCase): [1, 4, 0, 0], [4, 2, 9, 4]]) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testCollapseRepeatedExtraPadding(self): collapsed, new_seq_lengths = ctc_ops.collapse_repeated( labels=[[1, 3, 3, 3, 0, 0, 0], @@ -611,7 +611,7 @@ class CTCLossTestV2(test.TestCase): [1, 4, 0, 0], [4, 2, 9, 4]]) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testCollapseRepeatedFrontRepeats(self): collapsed, new_seq_lengths = ctc_ops.collapse_repeated( labels=[[1, 1, 1, 2, 2], @@ -625,7 +625,7 @@ class CTCLossTestV2(test.TestCase): [1, 2], [1, 0]]) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testCollapseRepeatedAllLabelsTheSame(self): collapsed, new_seq_lengths = ctc_ops.collapse_repeated( labels=[[1, 1, 1, 1, 1], @@ -658,7 +658,7 @@ class CTCLossTestV2(test.TestCase): self.assertAllEqual(padded_dense, new_dense) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testUnique(self): labels = [ [3, 4, 4, 3], @@ -674,7 +674,7 @@ class CTCLossTestV2(test.TestCase): [0, 0, 0, 1], ], idx) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testSumStates(self): idx = [ [0, 1, 0, 1], @@ -694,7 +694,7 @@ class CTCLossTestV2(test.TestCase): [1.8, 0.8, 0.0, 0.0]] ], sum_of_states) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testStateToOlabel(self): labels = [ [3, 4, 3, 4], @@ -733,7 +733,7 @@ class CTCLossTestV2(test.TestCase): [22.0 + 23.0 + 24.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]], ]) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testStateToOlabelUnique(self): labels = [ [3, 4, 3, 4], diff --git a/tensorflow/python/kernel_tests/dense_update_ops_no_tsan_test.py b/tensorflow/python/kernel_tests/dense_update_ops_no_tsan_test.py index 4f74e1e7412..4e3da068b89 100644 --- a/tensorflow/python/kernel_tests/dense_update_ops_no_tsan_test.py +++ b/tensorflow/python/kernel_tests/dense_update_ops_no_tsan_test.py @@ -33,7 +33,7 @@ class AssignOpTest(test.TestCase): # NOTE(mrry): We exclude thess tests from the TSAN TAP target, because they # contain benign and deliberate data races when multiple threads update # the same parameters without a lock. - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testParallelUpdateWithoutLocking(self): with self.cached_session() as sess: ones_t = array_ops.fill([1024, 1024], 1.0) @@ -61,7 +61,7 @@ class AssignOpTest(test.TestCase): self.assertTrue((vals >= ones).all()) self.assertTrue((vals <= ones * 20).all()) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testParallelAssignWithoutLocking(self): with self.cached_session() as sess: ones_t = array_ops.fill([1024, 1024], float(1)) @@ -94,7 +94,7 @@ class AssignOpTest(test.TestCase): # contain non-benign but known data races between the variable assignment and # returning the output tensors. This issue will be resolved with the new # resource variables. - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testParallelUpdateWithLocking(self): with self.cached_session() as sess: zeros_t = array_ops.fill([1024, 1024], 0.0) @@ -122,7 +122,7 @@ class AssignOpTest(test.TestCase): ones = np.ones((1024, 1024)).astype(np.float32) self.assertAllEqual(vals, ones * 20) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testParallelAssignWithLocking(self): with self.cached_session() as sess: zeros_t = array_ops.fill([1024, 1024], 0.0) diff --git a/tensorflow/python/kernel_tests/dense_update_ops_test.py b/tensorflow/python/kernel_tests/dense_update_ops_test.py index 309da88bef7..545de87ca10 100644 --- a/tensorflow/python/kernel_tests/dense_update_ops_test.py +++ b/tensorflow/python/kernel_tests/dense_update_ops_test.py @@ -86,7 +86,7 @@ class AssignOpTest(test.TestCase): def testBasic(self): self._testTypes(np.arange(0, 20).reshape([4, 5])) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testAssignNonStrictShapeChecking(self): with self.cached_session(): data = array_ops.fill([1024, 1024], 0) @@ -101,7 +101,7 @@ class AssignOpTest(test.TestCase): a2.op.run() self.assertAllEqual(p.eval(), self.evaluate(data2)) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testInitRequiredAssignAdd(self): with self.cached_session(): p = variables.VariableV1(array_ops.fill([1024, 1024], 1), dtypes.int32) @@ -109,7 +109,7 @@ class AssignOpTest(test.TestCase): with self.assertRaisesOpError("use uninitialized"): a.op.run() - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testInitRequiredAssignSub(self): with self.cached_session(): p = variables.VariableV1(array_ops.fill([1024, 1024], 1), dtypes.int32) diff --git a/tensorflow/python/kernel_tests/depthwise_conv_op_test.py b/tensorflow/python/kernel_tests/depthwise_conv_op_test.py index f6d834c2f85..5b1a47fb035 100644 --- a/tensorflow/python/kernel_tests/depthwise_conv_op_test.py +++ b/tensorflow/python/kernel_tests/depthwise_conv_op_test.py @@ -24,6 +24,7 @@ from tensorflow.python.framework import constant_op from tensorflow.python.framework import dtypes from tensorflow.python.framework import errors from tensorflow.python.framework import ops +from tensorflow.python.framework import test_util from tensorflow.python.ops import array_ops from tensorflow.python.ops import gradient_checker from tensorflow.python.ops import nn_impl @@ -185,6 +186,7 @@ class DepthwiseConv2DTest(test.TestCase): self.assertShapeEqual(native_result, conv_native) self.assertShapeEqual(native_result, conv_interface) + @test_util.run_v1_only("b/120545219") def testDepthwiseConv2D(self): for index, (input_size, filter_size, _, stride, padding) in enumerate(ConfigsToTest()): @@ -428,6 +430,7 @@ class DepthwiseConv2DTest(test.TestCase): use_gpu, grouped_conv, err) self.assertLess(err, tolerance) + @test_util.run_v1_only("b/120545219") def testDepthwiseConv2DInputGrad(self): for index, (input_size, filter_size, output_size, stride, padding) in enumerate(CheckGradConfigsToTest()): @@ -477,6 +480,7 @@ class DepthwiseConv2DTest(test.TestCase): use_gpu=True, data_format="NCHW") + @test_util.run_v1_only("b/120545219") def testDepthwiseConv2DFilterGrad(self): for index, (input_size, filter_size, output_size, stride, padding) in enumerate(CheckGradConfigsToTest()): diff --git a/tensorflow/python/kernel_tests/determinant_op_test.py b/tensorflow/python/kernel_tests/determinant_op_test.py index d6ef9e70b83..dbfda385ed2 100644 --- a/tensorflow/python/kernel_tests/determinant_op_test.py +++ b/tensorflow/python/kernel_tests/determinant_op_test.py @@ -133,6 +133,7 @@ class DeterminantOpTest(test.TestCase): huge_matrix = np.array([[max_double, 0.0], [0.0, max_double]]) self._compareDeterminant(huge_matrix) + @test_util.run_v1_only("b/120545219") def testNonSquareMatrix(self): # When the determinant of a non-square matrix is attempted we should return # an error @@ -140,6 +141,7 @@ class DeterminantOpTest(test.TestCase): linalg_ops.matrix_determinant( np.array([[1., 2., 3.], [3., 5., 4.]]).astype(np.float32)) + @test_util.run_v1_only("b/120545219") def testWrongDimensions(self): # The input to the determinant should be a 2-dimensional tensor. tensor1 = constant_op.constant([1., 2.]) @@ -150,6 +152,7 @@ class DeterminantOpTest(test.TestCase): self._compareDeterminant(np.empty([0, 2, 2])) self._compareDeterminant(np.empty([2, 0, 0])) + @test_util.run_v1_only("b/120545219") def testConcurrentExecutesWithoutError(self): with self.session(use_gpu=True) as sess: matrix1 = random_ops.random_normal([5, 5], seed=42) diff --git a/tensorflow/python/kernel_tests/distributions/multinomial_test.py b/tensorflow/python/kernel_tests/distributions/multinomial_test.py index b3f3416a52f..187ddd4cf41 100644 --- a/tensorflow/python/kernel_tests/distributions/multinomial_test.py +++ b/tensorflow/python/kernel_tests/distributions/multinomial_test.py @@ -22,6 +22,7 @@ from tensorflow.python.eager import backprop from tensorflow.python.framework import constant_op from tensorflow.python.framework import dtypes from tensorflow.python.framework import tensor_shape +from tensorflow.python.framework import test_util from tensorflow.python.ops import array_ops from tensorflow.python.ops import math_ops from tensorflow.python.ops.distributions import multinomial @@ -33,6 +34,7 @@ class MultinomialTest(test.TestCase): def setUp(self): self._rng = np.random.RandomState(42) + @test_util.run_v1_only("b/120545219") def testSimpleShapes(self): with self.cached_session(): p = [.1, .3, .6] @@ -42,6 +44,7 @@ class MultinomialTest(test.TestCase): self.assertEqual(tensor_shape.TensorShape([3]), dist.event_shape) self.assertEqual(tensor_shape.TensorShape([]), dist.batch_shape) + @test_util.run_v1_only("b/120545219") def testComplexShapes(self): with self.cached_session(): p = 0.5 * np.ones([3, 2, 2], dtype=np.float32) @@ -52,6 +55,7 @@ class MultinomialTest(test.TestCase): self.assertEqual(tensor_shape.TensorShape([2]), dist.event_shape) self.assertEqual(tensor_shape.TensorShape([3, 2]), dist.batch_shape) + @test_util.run_v1_only("b/120545219") def testN(self): p = [[0.1, 0.2, 0.7], [0.2, 0.3, 0.5]] n = [[3.], [4]] @@ -60,6 +64,7 @@ class MultinomialTest(test.TestCase): self.assertEqual((2, 1), dist.total_count.get_shape()) self.assertAllClose(n, dist.total_count.eval()) + @test_util.run_v1_only("b/120545219") def testP(self): p = [[0.1, 0.2, 0.7]] with self.cached_session(): @@ -68,6 +73,7 @@ class MultinomialTest(test.TestCase): self.assertEqual((1, 3), dist.logits.get_shape()) self.assertAllClose(p, dist.probs.eval()) + @test_util.run_v1_only("b/120545219") def testLogits(self): p = np.array([[0.1, 0.2, 0.7]], dtype=np.float32) logits = np.log(p) - 50. @@ -78,6 +84,7 @@ class MultinomialTest(test.TestCase): self.assertAllClose(p, multinom.probs.eval()) self.assertAllClose(logits, multinom.logits.eval()) + @test_util.run_v1_only("b/120545219") def testPmfUnderflow(self): logits = np.array([[-200, 0]], dtype=np.float32) with self.cached_session(): @@ -85,6 +92,7 @@ class MultinomialTest(test.TestCase): lp = dist.log_prob([1., 0.]).eval()[0] self.assertAllClose(-200, lp, atol=0, rtol=1e-6) + @test_util.run_v1_only("b/120545219") def testPmfandCountsAgree(self): p = [[0.1, 0.2, 0.7]] n = [[5.]] @@ -97,6 +105,7 @@ class MultinomialTest(test.TestCase): with self.assertRaisesOpError("counts must sum to `self.total_count`"): dist.prob([3., 3, 0]).eval() + @test_util.run_v1_only("b/120545219") def testPmfNonIntegerCounts(self): p = [[0.1, 0.2, 0.7]] n = [[5.]] @@ -157,6 +166,7 @@ class MultinomialTest(test.TestCase): self.assertAllClose([0.1, 0.9], self.evaluate(pmf)) self.assertEqual((2), pmf.get_shape()) + @test_util.run_v1_only("b/120545219") def testPmfCountsStretchedInBroadcastWhenSameRank(self): with self.cached_session(): p = [[0.1, 0.9], [0.7, 0.3]] @@ -165,6 +175,7 @@ class MultinomialTest(test.TestCase): self.assertAllClose(pmf.eval(), [0.1, 0.7]) self.assertEqual((2), pmf.get_shape()) + @test_util.run_v1_only("b/120545219") def testPmfCountsStretchedInBroadcastWhenLowerRank(self): with self.cached_session(): p = [[0.1, 0.9], [0.7, 0.3]] @@ -194,6 +205,7 @@ class MultinomialTest(test.TestCase): self.evaluate(pmf) self.assertEqual((4, 3), pmf.get_shape()) + @test_util.run_v1_only("b/120545219") def testMultinomialMean(self): with self.cached_session(): n = 5. @@ -203,6 +215,7 @@ class MultinomialTest(test.TestCase): self.assertEqual((3,), dist.mean().get_shape()) self.assertAllClose(expected_means, dist.mean().eval()) + @test_util.run_v1_only("b/120545219") def testMultinomialCovariance(self): with self.cached_session(): n = 5. @@ -214,6 +227,7 @@ class MultinomialTest(test.TestCase): self.assertEqual((3, 3), dist.covariance().get_shape()) self.assertAllClose(expected_covariances, dist.covariance().eval()) + @test_util.run_v1_only("b/120545219") def testMultinomialCovarianceBatch(self): with self.cached_session(): # Shape [2] @@ -246,6 +260,7 @@ class MultinomialTest(test.TestCase): self.assertEqual((3, 5, 4, 4), covariance.get_shape()) self.assertEqual((6, 3, 3, 3), covariance2.get_shape()) + @test_util.run_v1_only("b/120545219") def testCovarianceFromSampling(self): # We will test mean, cov, var, stddev on a DirichletMultinomial constructed # via broadcast between alpha, n. @@ -288,6 +303,7 @@ class MultinomialTest(test.TestCase): self.assertAllClose(sample_var_, analytic_var, atol=0.01, rtol=0.01) self.assertAllClose(sample_stddev_, analytic_stddev, atol=0.01, rtol=0.01) + @test_util.run_v1_only("b/120545219") def testSampleUnbiasedNonScalarBatch(self): with self.cached_session() as sess: dist = multinomial.Multinomial( @@ -317,6 +333,7 @@ class MultinomialTest(test.TestCase): self.assertAllClose( actual_covariance_, sample_covariance_, atol=0., rtol=0.20) + @test_util.run_v1_only("b/120545219") def testSampleUnbiasedScalarBatch(self): with self.cached_session() as sess: dist = multinomial.Multinomial( diff --git a/tensorflow/python/kernel_tests/fifo_queue_test.py b/tensorflow/python/kernel_tests/fifo_queue_test.py index 9655351a01e..0579dddb702 100644 --- a/tensorflow/python/kernel_tests/fifo_queue_test.py +++ b/tensorflow/python/kernel_tests/fifo_queue_test.py @@ -39,6 +39,7 @@ from tensorflow.python.platform import test from tensorflow.python.util import compat +@test_util.run_v1_only("b/120545219") class FIFOQueueTest(test.TestCase): def testConstructor(self): @@ -1423,6 +1424,7 @@ class FIFOQueueTest(test.TestCase): session.run([a, c]) +@test_util.run_v1_only("b/120545219") class FIFOQueueDictTest(test.TestCase): def testConstructor(self): @@ -1583,6 +1585,7 @@ class FIFOQueueDictTest(test.TestCase): self.assertTrue([compat.as_bytes("dd"), compat.as_bytes("ee")], list(s)) +@test_util.run_v1_only("b/120545219") class FIFOQueueWithTimeoutTest(test.TestCase): def testDequeueWithTimeout(self): @@ -1617,6 +1620,7 @@ class FIFOQueueWithTimeoutTest(test.TestCase): self.assertEqual(37, self.evaluate(dequeued_t)) +@test_util.run_v1_only("b/120545219") class QueueContainerTest(test.TestCase): def testContainer(self): diff --git a/tensorflow/python/kernel_tests/functional_ops_test.py b/tensorflow/python/kernel_tests/functional_ops_test.py index c489623fe56..95ee454614e 100644 --- a/tensorflow/python/kernel_tests/functional_ops_test.py +++ b/tensorflow/python/kernel_tests/functional_ops_test.py @@ -494,7 +494,7 @@ class FunctionalOpsTest(test.TestCase): @test_util.disable_control_flow_v2("b/119323354") @test_util.run_in_graph_and_eager_modes - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testMapEmptyScalar(self): map_return = functional_ops.map_fn(lambda x: 1, constant_op.constant([])) self.assertAllEqual([0], map_return.get_shape().dims) @@ -503,7 +503,7 @@ class FunctionalOpsTest(test.TestCase): # TODO(akshayka): this test fails in eager: the iterable is of length 0 so # so the body of the while loop never executes @test_util.disable_control_flow_v2("b/119323354") - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testMapEmptyTensor(self): with self.cached_session(): map_return = functional_ops.map_fn(lambda x: array_ops.zeros([3, 2]), @@ -797,7 +797,7 @@ class FunctionalOpsTest(test.TestCase): self.assertAllEqual(Run(100., False), 5050.) self.assertAllEqual(Run(100., True), 5050.) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testWhileError(self): for use_gpu in (True, False): with ops.Graph().as_default() as g: @@ -1027,7 +1027,7 @@ class FunctionalOpsTest(test.TestCase): def testForMLPWhile(self): self._testForMLP(True) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testForError(self): @function.Defun(dtypes.int32, dtypes.float32) @@ -1233,7 +1233,7 @@ class PartitionedCallTest(test.TestCase): self.assertAllEqual(expected, result) # Use an invalid executor name to test the plumbing of the executor_type attr. - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testExecutorTypeAttrExecutorNotFound(self): @function.Defun(dtypes.int32) def AddFive(x): diff --git a/tensorflow/python/kernel_tests/identity_op_py_test.py b/tensorflow/python/kernel_tests/identity_op_py_test.py index 1a6794e896f..40ec9db4226 100644 --- a/tensorflow/python/kernel_tests/identity_op_py_test.py +++ b/tensorflow/python/kernel_tests/identity_op_py_test.py @@ -62,7 +62,7 @@ class IdentityOpTest(test.TestCase): self.assertEquals(shape, array_ops.identity(np.array(array_2x3)).get_shape()) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testRefIdentityShape(self): with self.cached_session(): shape = [2, 3] diff --git a/tensorflow/python/kernel_tests/linalg/linear_operator_test.py b/tensorflow/python/kernel_tests/linalg/linear_operator_test.py index 8f8b15e8ed8..18e13a76a09 100644 --- a/tensorflow/python/kernel_tests/linalg/linear_operator_test.py +++ b/tensorflow/python/kernel_tests/linalg/linear_operator_test.py @@ -214,7 +214,7 @@ class LinearOperatorTest(test.TestCase): operator = LinearOperatorMatmulSolve(matrix, is_square=True) self.assertTrue(operator.is_square) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def test_linear_operator_matmul_hints_closed(self): matrix = array_ops.placeholder(dtypes.float32) operator1 = LinearOperatorMatmulSolve(matrix) @@ -241,7 +241,7 @@ class LinearOperatorTest(test.TestCase): self.assertTrue(operator_matmul.is_self_adjoint) self.assertEqual(None, operator_matmul.is_positive_definite) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def test_linear_operator_matmul_hints_false(self): matrix = array_ops.placeholder(dtypes.float32) operator1 = LinearOperatorMatmulSolve( @@ -274,7 +274,7 @@ class LinearOperatorTest(test.TestCase): self.assertEqual(None, operator_matmul.is_self_adjoint) self.assertEqual(None, operator_matmul.is_positive_definite) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def test_linear_operator_matmul_hint_infer_square(self): matrix1 = array_ops.placeholder(shape=[2, 3], dtype=dtypes.float32) matrix2 = array_ops.placeholder(shape=[3, 2], dtype=dtypes.float32) diff --git a/tensorflow/python/kernel_tests/linalg_grad_test.py b/tensorflow/python/kernel_tests/linalg_grad_test.py index 28e1d7e1684..ff842216118 100644 --- a/tensorflow/python/kernel_tests/linalg_grad_test.py +++ b/tensorflow/python/kernel_tests/linalg_grad_test.py @@ -61,6 +61,7 @@ class MatrixUnaryFunctorGradientTest(test_lib.TestCase): def _GetMatrixUnaryFunctorGradientTest(functor_, dtype_, shape_, **kwargs_): + @test_util.run_v1_only('b/120545219') def Test(self): with self.session(use_gpu=True): np.random.seed(1) @@ -103,6 +104,7 @@ def _GetMatrixBinaryFunctorGradientTest(functor_, float32_tol_fudge=1.0, **kwargs_): + @test_util.run_v1_only('b/120545219') def Test(self): # TODO(rmlarsen): Debug illegal address bug on CUDA and re-enable # GPU test for matrix_solve. diff --git a/tensorflow/python/kernel_tests/losses_test.py b/tensorflow/python/kernel_tests/losses_test.py index abff61f81b0..4584a27e622 100644 --- a/tensorflow/python/kernel_tests/losses_test.py +++ b/tensorflow/python/kernel_tests/losses_test.py @@ -51,26 +51,26 @@ class AbsoluteDifferenceLossTest(test.TestCase): losses.absolute_difference( self._predictions, self._predictions, weights=None) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testAllCorrectNoLossWeight(self): loss = losses.absolute_difference(self._predictions, self._predictions) with self.cached_session(): self.assertAlmostEqual(0.0, self.evaluate(loss), 3) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testNonZeroLoss(self): loss = losses.absolute_difference(self._labels, self._predictions) with self.cached_session(): self.assertAlmostEqual(5.5, self.evaluate(loss), 3) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testNonZeroLossWithPythonScalarWeight(self): weights = 2.3 loss = losses.absolute_difference(self._labels, self._predictions, weights) with self.cached_session(): self.assertAlmostEqual(5.5 * weights, self.evaluate(loss), 3) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testNonZeroLossWithScalarTensorWeight(self): weights = 2.3 loss = losses.absolute_difference(self._labels, self._predictions, @@ -148,7 +148,7 @@ class SoftmaxCrossEntropyLossTest(test.TestCase): self.assertEquals(loss.op.name, 'softmax_cross_entropy_loss/value') self.assertAlmostEqual(loss.eval(), 10.0, 3) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testNonZeroLossWithPythonScalarWeight(self): logits = constant_op.constant([[10.0, 0.0, 0.0], [0.0, 10.0, 0.0], [0.0, 0.0, 10.0]]) @@ -158,7 +158,7 @@ class SoftmaxCrossEntropyLossTest(test.TestCase): loss = losses.softmax_cross_entropy(labels, logits, weights) self.assertAlmostEqual(weights * 10.0, self.evaluate(loss), 3) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testNonZeroLossWithScalarTensorWeight(self): logits = constant_op.constant([[10.0, 0.0, 0.0], [0.0, 10.0, 0.0], [0.0, 0.0, 10.0]]) @@ -311,7 +311,7 @@ class SparseSoftmaxCrossEntropyLossTest(test.TestCase): self.assertEquals(loss.op.name, 'sparse_softmax_cross_entropy_loss/value') self.assertAlmostEqual(loss.eval(), 10.0, 3) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testNonZeroLossWithPythonScalarWeight(self): logits = constant_op.constant([[10.0, 0.0, 0.0], [0.0, 10.0, 0.0], [0.0, 0.0, 10.0]]) @@ -321,7 +321,7 @@ class SparseSoftmaxCrossEntropyLossTest(test.TestCase): loss = losses.sparse_softmax_cross_entropy(labels, logits, weights) self.assertAlmostEqual(weights * 10.0, self.evaluate(loss), 3) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testNonZeroLossWithScalarTensorWeight(self): logits = constant_op.constant([[10.0, 0.0, 0.0], [0.0, 10.0, 0.0], [0.0, 0.0, 10.0]]) @@ -677,13 +677,13 @@ class LogLossTest(test.TestCase): with self.assertRaises(ValueError): losses.log_loss(self._labels, self._labels, weights=None) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testAllCorrectNoLossWeight(self): loss = losses.log_loss(self._labels, self._labels) with self.cached_session(): self.assertAlmostEqual(0.0, self.evaluate(loss), 3) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testAllCorrectNoLossWeightWithPlaceholder(self): tf_predictions = array_ops.placeholder( dtypes.float32, shape=self._np_labels.shape) @@ -692,14 +692,14 @@ class LogLossTest(test.TestCase): self.assertAlmostEqual( 0.0, loss.eval(feed_dict={tf_predictions: self._np_labels}), 3) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testNonZeroLoss(self): loss = losses.log_loss(self._labels, self._predictions) with self.cached_session(): self.assertAlmostEqual(-np.sum(self._expected_losses) / 6.0, self.evaluate(loss), 3) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testNonZeroLossWithPythonScalarWeight(self): weights = 2.3 loss = losses.log_loss(self._labels, self._predictions, weights) @@ -707,7 +707,7 @@ class LogLossTest(test.TestCase): self.assertAlmostEqual(weights * -np.sum(self._expected_losses) / 6.0, self.evaluate(loss), 3) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testNonZeroLossWithScalarTensorWeight(self): weights = 2.3 loss = losses.log_loss(self._labels, self._predictions, @@ -716,7 +716,7 @@ class LogLossTest(test.TestCase): self.assertAlmostEqual(weights * -np.sum(self._expected_losses) / 6.0, self.evaluate(loss), 3) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testNonZeroLossWithScalarTensorWeightAndPlaceholder(self): tf_predictions = array_ops.placeholder( dtypes.float32, shape=self._np_predictions.shape) @@ -728,7 +728,7 @@ class LogLossTest(test.TestCase): self.assertAlmostEqual(weights * -np.sum(self._expected_losses) / 6.0, loss, 3) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testNonZeroLossWithScalarTensorWeightAndPlaceholderWithRankOnly(self): tf_predictions = array_ops.placeholder(dtypes.float32, shape=[None, None]) weights = 2.3 @@ -788,7 +788,7 @@ class LogLossTest(test.TestCase): self.assertAlmostEqual(-np.sum(expected_losses) / 5.0, self.evaluate(loss), 3) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testNonZeroLossWithMeasurementSpecificWeightsWithPlaceholder(self): weights = np.array([3, 6, 5, 0, 4, 2]).reshape((2, 3)) expected_losses = np.multiply(self._expected_losses, weights) @@ -816,7 +816,7 @@ class LogLossTest(test.TestCase): with self.cached_session(): self.assertAlmostEqual(-np.sum(expected_losses), self.evaluate(loss), 3) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testNonZeroLossWithSampleSpecificWeightsMostZeroWithPlaceholder(self): weights = np.array([0, 0, 0, 0, 0, 2]).reshape((2, 3)) expected_losses = np.multiply(self._expected_losses, weights) @@ -955,26 +955,26 @@ class MeanSquaredErrorTest(test.TestCase): losses.mean_squared_error(predictions=constant_op.constant(0), labels=constant_op.constant(0)).eval()) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testAllCorrectNoLossWeight(self): loss = losses.mean_squared_error(self._predictions, self._predictions) with self.cached_session(): self.assertAlmostEqual(0.0, self.evaluate(loss), 3) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testNonZeroLoss(self): loss = losses.mean_squared_error(self._labels, self._predictions) with self.cached_session(): self.assertAlmostEqual(49.5, self.evaluate(loss), 3) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testNonZeroLossWithPythonScalarWeight(self): weights = 2.3 loss = losses.mean_squared_error(self._labels, self._predictions, weights) with self.cached_session(): self.assertAlmostEqual(49.5 * weights, self.evaluate(loss), 3) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testNonZeroLossWithScalarTensorWeight(self): weights = 2.3 loss = losses.mean_squared_error(self._labels, self._predictions, @@ -1068,12 +1068,12 @@ class MeanPairwiseSquaredErrorTest(test.TestCase): self.assertAlmostEqual( expected_loss, dynamic_inputs_op.eval(feed_dict=feed_dict), places=3) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testAllCorrectNoLossWeight(self): self._test_valid_weights( self._labels, self._labels, expected_loss=0.0) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testNonZeroLoss(self): self._test_valid_weights( self._labels, self._predictions, @@ -1104,7 +1104,7 @@ class MeanPairwiseSquaredErrorTest(test.TestCase): np_grad = self.evaluate(grad) self.assertFalse(np.isnan(np_grad).any()) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testNonZeroLossWithPythonScalarWeight(self): weight = 2.3 self._test_valid_weights( @@ -1112,7 +1112,7 @@ class MeanPairwiseSquaredErrorTest(test.TestCase): expected_loss=weight * np.sum(self._expected_losses), weights=weight) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testNonZeroLossWithScalarTensorWeight(self): weights = 2.3 loss = losses.mean_pairwise_squared_error( @@ -1179,7 +1179,7 @@ class MeanPairwiseSquaredErrorTest(test.TestCase): weights_placeholder: weights, }) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testInvalid3dWeighted2x0(self): labels = np.array([ [[1, 9, 2], [12, 11, 10], [9, 8, 7]], diff --git a/tensorflow/python/kernel_tests/matrix_band_part_op_test.py b/tensorflow/python/kernel_tests/matrix_band_part_op_test.py index 129ea40dfe6..fdb7e4a1a4e 100644 --- a/tensorflow/python/kernel_tests/matrix_band_part_op_test.py +++ b/tensorflow/python/kernel_tests/matrix_band_part_op_test.py @@ -23,6 +23,7 @@ from tensorflow.python.client import session from tensorflow.python.framework import constant_op from tensorflow.python.framework import dtypes as dtypes_lib from tensorflow.python.framework import ops +from tensorflow.python.framework import test_util from tensorflow.python.ops import array_ops from tensorflow.python.ops import control_flow_ops from tensorflow.python.ops import gradient_checker @@ -44,6 +45,7 @@ class MatrixBandPartTest(test_lib.TestCase): def _GetMatrixBandPartTest(dtype_, batch_shape_, shape_): + @test_util.run_v1_only("b/120545219") def Test(self): mat = np.ones(shape_).astype(dtype_) batch_mat = np.tile(mat, batch_shape_ + (1, 1)) @@ -73,6 +75,7 @@ class MatrixBandPartGradTest(test_lib.TestCase): def _GetMatrixBandPartGradTest(dtype_, batch_shape_, shape_): + @test_util.run_v1_only("b/120545219") def Test(self): shape = batch_shape_ + shape_ x = constant_op.constant(np.random.rand(*shape), dtype=dtype_) diff --git a/tensorflow/python/kernel_tests/matrix_logarithm_op_test.py b/tensorflow/python/kernel_tests/matrix_logarithm_op_test.py index b0bce6a1b9b..682ac12adc6 100644 --- a/tensorflow/python/kernel_tests/matrix_logarithm_op_test.py +++ b/tensorflow/python/kernel_tests/matrix_logarithm_op_test.py @@ -84,6 +84,7 @@ class LogarithmOpTest(test.TestCase): # Complex batch self._verifyLogarithmComplex(self._makeBatch(matrix1, matrix2)) + @test_util.run_v1_only("b/120545219") def testNonSquareMatrix(self): # When the logarithm of a non-square matrix is attempted we should return # an error @@ -91,6 +92,7 @@ class LogarithmOpTest(test.TestCase): gen_linalg_ops.matrix_logarithm( np.array([[1., 2., 3.], [3., 4., 5.]], dtype=np.complex64)) + @test_util.run_v1_only("b/120545219") def testWrongDimensions(self): # The input to the logarithm should be at least a 2-dimensional tensor. tensor3 = constant_op.constant([1., 2.], dtype=dtypes.complex64) @@ -121,6 +123,7 @@ class LogarithmOpTest(test.TestCase): size=np.prod(shape)).reshape(shape).astype(np.complex128) self._verifyLogarithmComplex(matrix) + @test_util.run_v1_only("b/120545219") def testConcurrentExecutesWithoutError(self): with self.session(use_gpu=True) as sess: matrix1 = math_ops.cast( diff --git a/tensorflow/python/kernel_tests/matrix_solve_ls_op_test.py b/tensorflow/python/kernel_tests/matrix_solve_ls_op_test.py index 42fd95d3113..463477a6a2c 100644 --- a/tensorflow/python/kernel_tests/matrix_solve_ls_op_test.py +++ b/tensorflow/python/kernel_tests/matrix_solve_ls_op_test.py @@ -135,7 +135,7 @@ class MatrixSolveLsOpTest(test_lib.TestCase): self.assertEqual(np_ans.shape, tf_ans_val.shape) self.assertAllClose(np_ans, tf_ans_val, atol=2 * tol, rtol=2 * tol) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testWrongDimensions(self): # The matrix and right-hand sides should have the same number of rows. with self.session(use_gpu=True): @@ -144,7 +144,6 @@ class MatrixSolveLsOpTest(test_lib.TestCase): with self.assertRaises(ValueError): linalg_ops.matrix_solve_ls(matrix, rhs) - @test_util.run_deprecated_v1 def testEmpty(self): full = np.array([[1., 2.], [3., 4.], [5., 6.]]) empty0 = np.empty([3, 0]) @@ -164,7 +163,7 @@ class MatrixSolveLsOpTest(test_lib.TestCase): linalg_ops.matrix_solve_ls(empty1, empty1, fast=fast)) self.assertEqual(tf_ans.shape, (2, 2)) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testBatchResultSize(self): # 3x3x3 matrices, 3x3x1 right-hand sides. matrix = np.array([1., 2., 3., 4., 5., 6., 7., 8., 9.] * 3).reshape(3, 3, 3) diff --git a/tensorflow/python/kernel_tests/matrix_square_root_op_test.py b/tensorflow/python/kernel_tests/matrix_square_root_op_test.py index 1e2109b8c41..3edb390c724 100644 --- a/tensorflow/python/kernel_tests/matrix_square_root_op_test.py +++ b/tensorflow/python/kernel_tests/matrix_square_root_op_test.py @@ -90,17 +90,20 @@ class SquareRootOpTest(test.TestCase): self._verifySquareRootReal(np.empty([0, 2, 2])) self._verifySquareRootReal(np.empty([2, 0, 0])) + @test_util.run_v1_only("b/120545219") def testWrongDimensions(self): # The input to the square root should be at least a 2-dimensional tensor. tensor = constant_op.constant([1., 2.]) with self.assertRaises(ValueError): gen_linalg_ops.matrix_square_root(tensor) + @test_util.run_v1_only("b/120545219") def testNotSquare(self): with self.assertRaises(ValueError): tensor = constant_op.constant([[1., 0., -1.], [-1., 1., 0.]]) self.evaluate(gen_linalg_ops.matrix_square_root(tensor)) + @test_util.run_v1_only("b/120545219") def testConcurrentExecutesWithoutError(self): with test_util.use_gpu(): matrix1 = random_ops.random_normal([5, 5], seed=42) diff --git a/tensorflow/python/kernel_tests/norm_op_test.py b/tensorflow/python/kernel_tests/norm_op_test.py index 5ff0c58bf1b..20b9ad95c8b 100644 --- a/tensorflow/python/kernel_tests/norm_op_test.py +++ b/tensorflow/python/kernel_tests/norm_op_test.py @@ -21,6 +21,7 @@ from __future__ import print_function import numpy as np from tensorflow.python.framework import constant_op +from tensorflow.python.framework import test_util from tensorflow.python.ops import array_ops from tensorflow.python.ops import linalg_ops from tensorflow.python.platform import test as test_lib @@ -35,6 +36,7 @@ def _AddTest(test, test_name, fn): class NormOpTest(test_lib.TestCase): + @test_util.run_v1_only("b/120545219") def testBadOrder(self): matrix = [[0., 1.], [2., 3.]] for ord_ in "fro", -7, -1.1, 0: @@ -52,6 +54,7 @@ class NormOpTest(test_lib.TestCase): "'ord' must be a supported matrix norm"): linalg_ops.norm(matrix, ord=ord_, axis=[-2, -1]) + @test_util.run_v1_only("b/120545219") def testInvalidAxis(self): matrix = [[0., 1.], [2., 3.]] for axis_ in [], [1, 2, 3], [[1]], [[1], [2]], [3.1415], [1, 1]: @@ -78,6 +81,7 @@ def _GetNormOpTest(dtype_, shape_, ord_, axis_, keep_dims_, use_static_shape_): tf_norm_val = sess.run(tf_norm, feed_dict={tf_matrix: matrix}) self.assertAllClose(np_norm, tf_norm_val, rtol=1e-5, atol=1e-5) + @test_util.run_v1_only("b/120545219") def Test(self): is_matrix_norm = (isinstance(axis_, tuple) or isinstance(axis_, list)) and len(axis_) == 2 diff --git a/tensorflow/python/kernel_tests/numerics_test.py b/tensorflow/python/kernel_tests/numerics_test.py index 5751f3fe767..f13f9d68062 100644 --- a/tensorflow/python/kernel_tests/numerics_test.py +++ b/tensorflow/python/kernel_tests/numerics_test.py @@ -64,9 +64,9 @@ class VerifyTensorAllFiniteTest(test.TestCase): self.evaluate(t_verified) +@test_util.run_v1_only("b/120545219") class NumericsTest(test.TestCase): - @test_util.run_deprecated_v1 def testInf(self): with self.session(graph=ops.Graph()): t1 = constant_op.constant(1.0) @@ -77,7 +77,6 @@ class NumericsTest(test.TestCase): with self.assertRaisesOpError("Inf"): self.evaluate(a) - @test_util.run_deprecated_v1 def testNaN(self): with self.session(graph=ops.Graph()): t1 = constant_op.constant(0.0) @@ -88,7 +87,6 @@ class NumericsTest(test.TestCase): with self.assertRaisesOpError("NaN"): self.evaluate(a) - @test_util.run_deprecated_v1 def testBoth(self): with self.session(graph=ops.Graph()): t1 = constant_op.constant([1.0, 0.0]) @@ -107,7 +105,6 @@ class NumericsTest(test.TestCase): self.assertAllEqual(np.array([[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]]), value) self.assertEqual([2, 3], checked.get_shape()) - @test_util.run_deprecated_v1 def testControlFlowCond(self): predicate = array_ops.placeholder(dtypes.bool, shape=[]) _ = control_flow_ops.cond(predicate, @@ -120,7 +117,6 @@ class NumericsTest(test.TestCase): r"or `tf.while_loop\(\)`\."): numerics.add_check_numerics_ops() - @test_util.run_deprecated_v1 def testControlFlowWhile(self): predicate = array_ops.placeholder(dtypes.bool, shape=[]) _ = control_flow_ops.while_loop(lambda _: predicate, diff --git a/tensorflow/python/kernel_tests/padding_fifo_queue_test.py b/tensorflow/python/kernel_tests/padding_fifo_queue_test.py index b4818360d57..e3999695d06 100644 --- a/tensorflow/python/kernel_tests/padding_fifo_queue_test.py +++ b/tensorflow/python/kernel_tests/padding_fifo_queue_test.py @@ -29,11 +29,13 @@ from tensorflow.python.framework import dtypes as dtypes_lib from tensorflow.python.framework import errors_impl from tensorflow.python.framework import ops from tensorflow.python.framework import tensor_shape +from tensorflow.python.framework import test_util from tensorflow.python.ops import array_ops from tensorflow.python.ops import data_flow_ops from tensorflow.python.platform import test +@test_util.run_v1_only("b/120545219") class PaddingFIFOQueueTest(test.TestCase): def testConstructor(self): @@ -1393,6 +1395,7 @@ class PaddingFIFOQueueTest(test.TestCase): with self.assertRaisesOpError("was cancelled"): self.evaluate(enqueue_many_op) + @test_util.run_deprecated_v1 def testResetOfBlockingOperation(self): with self.cached_session() as sess: q_empty = data_flow_ops.PaddingFIFOQueue(5, dtypes_lib.float32, ((),)) diff --git a/tensorflow/python/kernel_tests/partitioned_variables_test.py b/tensorflow/python/kernel_tests/partitioned_variables_test.py index 48655391fa7..da79b4ecfc0 100644 --- a/tensorflow/python/kernel_tests/partitioned_variables_test.py +++ b/tensorflow/python/kernel_tests/partitioned_variables_test.py @@ -412,7 +412,7 @@ class PartitionedVariablesTestCase(test.TestCase): def testResourceName(self): self._testNameHelper(use_resource=True) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testRandomInitValue(self): with self.cached_session(): rnd = variables.Variable(random_ops.random_uniform([200, 40])) @@ -430,7 +430,7 @@ class PartitionedVariablesTestCase(test.TestCase): "200 40 0,200:36,4" ]) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testRandomInitUnevenPartitions(self): with self.cached_session(): rnd = variables.Variable( @@ -469,7 +469,7 @@ class PartitionedVariablesTestCase(test.TestCase): if i < len(save_specs): self._TestSaveSpec(vs, save_specs[i]) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testDegenerate(self): with self.cached_session(): rnd = variables.Variable(random_ops.random_uniform([10, 43])) @@ -481,7 +481,7 @@ class PartitionedVariablesTestCase(test.TestCase): self.assertAllClose(rnd, val) self._TestSaveSpec(vs, ["10 43 0,10:0,43"]) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testSliceSizeOne(self): with self.cached_session(): rnd = variables.Variable(random_ops.random_uniform([10, 43])) diff --git a/tensorflow/python/kernel_tests/priority_queue_test.py b/tensorflow/python/kernel_tests/priority_queue_test.py index 9be682ea52f..49ec7ee4836 100644 --- a/tensorflow/python/kernel_tests/priority_queue_test.py +++ b/tensorflow/python/kernel_tests/priority_queue_test.py @@ -27,6 +27,7 @@ import numpy as np from tensorflow.python.framework import constant_op from tensorflow.python.framework import dtypes from tensorflow.python.framework import errors_impl +from tensorflow.python.framework import test_util from tensorflow.python.ops import array_ops from tensorflow.python.ops import data_flow_ops import tensorflow.python.ops.nn_grad # pylint: disable=unused-import @@ -35,6 +36,7 @@ from tensorflow.python.platform import test class PriorityQueueTest(test.TestCase): + @test_util.run_v1_only("b/120545219") def testRoundTripInsertReadOnceSorts(self): with self.cached_session() as sess: q = data_flow_ops.PriorityQueue(2000, (dtypes.string, dtypes.string), ( @@ -112,6 +114,7 @@ class PriorityQueueTest(test.TestCase): missed.remove((dv0, dv1)) self.assertEqual(missed, set()) + @test_util.run_v1_only("b/120545219") def testRoundTripFillsCapacityMultiThreadedEnqueueAndDequeue(self): with self.cached_session() as sess: q = data_flow_ops.PriorityQueue(10, (dtypes.int64), (())) @@ -267,6 +270,7 @@ class PriorityQueueTest(test.TestCase): missed.remove((dv0, dv1)) self.assertEqual(missed, set()) + @test_util.run_v1_only("b/120545219") def testRoundTripInsertOnceReadOnceSorts(self): with self.cached_session() as sess: q = data_flow_ops.PriorityQueue(2000, (dtypes.string, dtypes.string), ( @@ -288,6 +292,7 @@ class PriorityQueueTest(test.TestCase): for e, dv0, dv1 in zip(deq_elem, deq_value_0, deq_value_1): self.assertTrue((dv0, dv1) in allowed[e]) + @test_util.run_v1_only("b/120545219") def testRoundTripInsertOnceReadManySorts(self): with self.cached_session(): q = data_flow_ops.PriorityQueue(2000, (dtypes.int64), (())) @@ -296,6 +301,7 @@ class PriorityQueueTest(test.TestCase): deq_values = np.hstack((q.dequeue_many(100)[0].eval() for _ in range(10))) self.assertAllEqual(deq_values, sorted(elem)) + @test_util.run_v1_only("b/120545219") def testRoundTripInsertOnceReadOnceLotsSorts(self): with self.cached_session(): q = data_flow_ops.PriorityQueue(2000, (dtypes.int64), (())) @@ -311,6 +317,7 @@ class PriorityQueueTest(test.TestCase): with self.assertRaises(TypeError): q.enqueue_many((["a", "b", "c"], ["a", "b", "c"])).run() + @test_util.run_v1_only("b/120545219") def testInsertingNonScalarFails(self): with self.cached_session() as sess: input_priority = array_ops.placeholder(dtypes.int64) diff --git a/tensorflow/python/kernel_tests/py_func_test.py b/tensorflow/python/kernel_tests/py_func_test.py index 1f3f02a9f01..482633d539d 100644 --- a/tensorflow/python/kernel_tests/py_func_test.py +++ b/tensorflow/python/kernel_tests/py_func_test.py @@ -102,6 +102,7 @@ class PyFuncTest(test.TestCase): script_ops.eager_py_func(np_func, [x, y], [dtypes.float32])) self.assertEqual(z[0], np_func(1.0, 2.0).astype(np.float32)) + @test_util.run_v1_only("b/120545219") def testArray(self): with self.cached_session(): x = constant_op.constant([1.0, 2.0], dtypes.float64) @@ -168,6 +169,7 @@ class PyFuncTest(test.TestCase): (dtypes.float64, dtypes.float64))) self.assertAllClose(y, [0.0, 1.0]) + @test_util.run_v1_only("b/120545219") def testStrings(self): def read_fixed_length_numpy_strings(): @@ -185,6 +187,7 @@ class PyFuncTest(test.TestCase): script_ops.py_func(read_and_return_strings, [x, y], dtypes.string)) self.assertAllEqual(z, [b"hello there", b"hi there"]) + @test_util.run_v1_only("b/120545219") def testStringsAreConvertedToBytes(self): def read_fixed_length_numpy_strings(): @@ -202,6 +205,7 @@ class PyFuncTest(test.TestCase): script_ops.py_func(read_and_return_strings, [x, y], dtypes.string)) self.assertAllEqual(z, [b"hello there", b"hi there"]) + @test_util.run_v1_only("b/120545219") def testObjectArraysAreConvertedToBytes(self): def read_object_array(): @@ -217,12 +221,14 @@ class PyFuncTest(test.TestCase): z, = script_ops.py_func(read_and_return_strings, [x, y], [dtypes.string]) self.assertListEqual(list(z.eval()), [b"hello there", b"hi ya"]) + @test_util.run_v1_only("b/120545219") def testStringPadding(self): correct = [b"this", b"is", b"a", b"test"] with self.cached_session(): s, = script_ops.py_func(lambda: [correct], [], [dtypes.string]) self.assertAllEqual(s.eval(), correct) + @test_util.run_v1_only("b/120545219") def testStringPaddingAreConvertedToBytes(self): inp = ["this", "is", "a", "test"] correct = [b"this", b"is", b"a", b"test"] @@ -230,6 +236,7 @@ class PyFuncTest(test.TestCase): s, = script_ops.py_func(lambda: [inp], [], [dtypes.string]) self.assertAllEqual(s.eval(), correct) + @test_util.run_v1_only("b/120545219") def testLarge(self): with self.cached_session() as sess: x = array_ops.zeros([1000000], dtype=np.float32) @@ -243,6 +250,7 @@ class PyFuncTest(test.TestCase): x = self.evaluate(script_ops.py_func(lambda: 42.0, [], dtypes.float64)) self.assertAllClose(x, 42.0) + @test_util.run_v1_only("b/120545219") def testAlias(self): with self.cached_session(): np_array = np.array([1.0, 2.0], dtype=np.float32) @@ -251,6 +259,7 @@ class PyFuncTest(test.TestCase): value.op.run() self.assertAllEqual(np_array, [1.0, 2.0]) + @test_util.run_v1_only("b/120545219") def testReturnUnicodeString(self): with self.cached_session(): correct = u"你好 世界" @@ -261,6 +270,7 @@ class PyFuncTest(test.TestCase): z, = script_ops.py_func(unicode_string, [], [dtypes.string]) self.assertEqual(z.eval(), correct.encode("utf8")) + @test_util.run_v1_only("b/120545219") def testBadNumpyReturnType(self): with self.cached_session(): @@ -274,6 +284,7 @@ class PyFuncTest(test.TestCase): "Unsupported numpy type"): self.evaluate(y) + @test_util.run_v1_only("b/120545219") def testBadReturnType(self): with self.cached_session(): @@ -287,6 +298,7 @@ class PyFuncTest(test.TestCase): "Unsupported object type"): self.evaluate(z) + @test_util.run_v1_only("b/120545219") def testReturnInput(self): with self.cached_session(): @@ -321,6 +333,7 @@ class PyFuncTest(test.TestCase): self.assertEqual(self.evaluate(x), 0) self.assertEqual(self.evaluate(x), 0) + @test_util.run_v1_only("b/120545219") def testGradientFunction(self): # Input to tf.py_func is necessary, otherwise get_gradient_function() # returns None per default. @@ -330,6 +343,7 @@ class PyFuncTest(test.TestCase): self.assertEqual(None, ops.get_gradient_function(x.op)) self.assertEqual(None, ops.get_gradient_function(y.op)) + @test_util.run_v1_only("b/120545219") def testCOrder(self): with self.cached_session(): val = [[1, 2], [3, 4]] @@ -337,6 +351,7 @@ class PyFuncTest(test.TestCase): [dtypes.int64]) self.assertAllEqual(val, self.evaluate(x)) + @test_util.run_v1_only("b/120545219") def testParallel(self): # Tests that tf.py_func's can run in parallel if they release the GIL. with self.cached_session() as session: @@ -382,6 +397,7 @@ class PyFuncTest(test.TestCase): self.assertIsNone(ret) self.assertAllEqual([3], s.value) + @test_util.run_v1_only("b/120545219") def testNoReturnValueStateless(self): def do_nothing(unused_x): @@ -420,6 +436,7 @@ class PyFuncTest(test.TestCase): with self.assertRaisesWithPredicateMatch(tf_exp, expected_error_check): self.evaluate(f) + @test_util.run_v1_only("b/120545219") def testExceptionHandling(self): with self.cached_session(): self._testExceptionHandling(ValueError, errors.InvalidArgumentError) @@ -514,7 +531,7 @@ class PyFuncTest(test.TestCase): self.assertAllEqual(ret, [[3.0], [3.0], [3.0]]) @test_util.run_in_graph_and_eager_modes - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testEagerExceptionHandling(self): with test_util.device(use_gpu=True): self._testExceptionHandling( @@ -534,7 +551,7 @@ class PyFuncTest(test.TestCase): self._testExceptionHandling(WeirdError, errors.UnknownError, eager=True) @test_util.run_in_graph_and_eager_modes - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testEagerReturningVariableRaisesError(self): def return_variable(): return resource_variable_ops.ResourceVariable(0.0) @@ -558,6 +575,7 @@ class PyFuncTest(test.TestCase): dy_dx = tape.gradient(y, x) self.assertEqual(self.evaluate(dy_dx), 6.0) + @test_util.run_v1_only("b/120545219") def testEagerGradientGraph(self): def f(x): @@ -568,6 +586,7 @@ class PyFuncTest(test.TestCase): dy_dx = gradients_impl.gradients(y, x)[0] self.assertEqual(self.evaluate(dy_dx), 6.0) + @test_util.run_v1_only("b/120545219") def testEagerGradientGraphTwoOutputs(self): def f(x, y): @@ -597,6 +616,7 @@ class PyFuncTest(test.TestCase): self.assertEqual(self.evaluate(dz_dx), 6.0) self.assertEqual(self.evaluate(dz_dy), 8.0) + @test_util.run_v1_only("b/120545219") def testEagerGradientGraphMultipleArgs(self): def f(x, y): @@ -610,6 +630,7 @@ class PyFuncTest(test.TestCase): self.assertEqual(self.evaluate(dz_dx), 6.0) self.assertEqual(self.evaluate(dz_dy), 8.0) + @test_util.run_v1_only("b/120545219") def testEagerGradientGraphLogHuber(self): def log_huber(x, m): @@ -631,6 +652,7 @@ class PyFuncTest(test.TestCase): self.assertEqual(y, 1.0) self.assertEqual(dy_dx, 2.0) + @test_util.run_v1_only("b/120545219") def testEagerRespectsDevicePlacmentOfOp(self): def f(x): diff --git a/tensorflow/python/kernel_tests/qr_op_test.py b/tensorflow/python/kernel_tests/qr_op_test.py index 5e9767f20c9..5adb95c7d60 100644 --- a/tensorflow/python/kernel_tests/qr_op_test.py +++ b/tensorflow/python/kernel_tests/qr_op_test.py @@ -40,6 +40,7 @@ def _AddTest(test_class, op_name, testcase_name, fn): class QrOpTest(test.TestCase): + @test_util.run_v1_only("b/120545219") def testWrongDimensions(self): # The input to qr should be a tensor of at least rank 2. scalar = constant_op.constant(1.) @@ -115,6 +116,7 @@ def _GetQrOpTest(dtype_, shape_, full_matrices_, use_static_shape_): tol = 1e-14 self.assertAllClose(identity, xx, atol=tol) + @test_util.run_v1_only("b/120545219") def Test(self): np.random.seed(1) x_np = np.random.uniform( @@ -163,6 +165,7 @@ class QrGradOpTest(test.TestCase): def _GetQrGradOpTest(dtype_, shape_, full_matrices_): + @test_util.run_v1_only("b/120545219") def Test(self): np.random.seed(42) a = np.random.uniform(low=-1.0, high=1.0, size=shape_).astype(dtype_) diff --git a/tensorflow/python/kernel_tests/random/random_shuffle_queue_test.py b/tensorflow/python/kernel_tests/random/random_shuffle_queue_test.py index ed4f5434d9f..dd814a22b4e 100644 --- a/tensorflow/python/kernel_tests/random/random_shuffle_queue_test.py +++ b/tensorflow/python/kernel_tests/random/random_shuffle_queue_test.py @@ -29,11 +29,13 @@ from tensorflow.python.framework import dtypes as dtypes_lib from tensorflow.python.framework import errors_impl from tensorflow.python.framework import random_seed from tensorflow.python.framework import tensor_shape +from tensorflow.python.framework import test_util from tensorflow.python.ops import data_flow_ops from tensorflow.python.platform import test from tensorflow.python.platform import tf_logging +@test_util.run_v1_only("b/120545219") class RandomShuffleQueueTest(test.TestCase): def setUp(self): @@ -1415,6 +1417,7 @@ class RandomShuffleQueueTest(test.TestCase): self.assertItemsEqual(elem, results) + @test_util.run_v1_only("b/120545219") def testBigDequeueMany(self): with self.cached_session() as sess: q = data_flow_ops.RandomShuffleQueue(2, 0, dtypes_lib.int32, ((),)) diff --git a/tensorflow/python/kernel_tests/resource_variable_ops_test.py b/tensorflow/python/kernel_tests/resource_variable_ops_test.py index 3992d6bdfbb..433957fd1d3 100644 --- a/tensorflow/python/kernel_tests/resource_variable_ops_test.py +++ b/tensorflow/python/kernel_tests/resource_variable_ops_test.py @@ -628,7 +628,7 @@ class ResourceVariableOpsTest(test_util.TensorFlowTestCase): variable_def=other_v_def) self.assertTrue(other_v_prime._cached_value is not None) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testVariableDefInitializedInstances(self): with ops.Graph().as_default(), self.cached_session() as sess: v_def = resource_variable_ops.ResourceVariable( @@ -733,7 +733,7 @@ class ResourceVariableOpsTest(test_util.TensorFlowTestCase): self.assertEqual(0.0, self.evaluate(v.value())) @test_util.run_in_graph_and_eager_modes - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testDestroyResource(self): v = resource_variable_ops.ResourceVariable(3.0, name="var0") self.evaluate(variables.global_variables_initializer()) @@ -792,7 +792,7 @@ class ResourceVariableOpsTest(test_util.TensorFlowTestCase): with self.assertRaises(ValueError): _ = w.value().op.get_attr("_class") - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testSharedName(self): with self.cached_session(): v = resource_variable_ops.ResourceVariable(300.0, name="var4") @@ -849,7 +849,7 @@ class ResourceVariableOpsTest(test_util.TensorFlowTestCase): v.initializer.run(feed_dict={v.initial_value: 3.0}) self.assertEqual(3.0, v.value().eval()) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testControlFlowInitialization(self): """Expects an error if an initializer is in a control-flow scope.""" @@ -986,7 +986,7 @@ class ResourceVariableOpsTest(test_util.TensorFlowTestCase): self.assertAllEqual(self.evaluate(v.assign_add(1)), [1, 2, 3, 4]) @test_util.run_in_graph_and_eager_modes - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testCopyToGraphUninitialized(self): v = resource_variable_ops.ResourceVariable([0, 1, 2, 3]) copy_to_graph = ops.Graph() diff --git a/tensorflow/python/kernel_tests/rnn_test.py b/tensorflow/python/kernel_tests/rnn_test.py index 3bc457f8fb6..a49496e4ef1 100644 --- a/tensorflow/python/kernel_tests/rnn_test.py +++ b/tensorflow/python/kernel_tests/rnn_test.py @@ -262,7 +262,7 @@ class RNNTest(test.TestCase): rnn.dynamic_rnn(cell, inputs, dtype=dtypes.float32, sequence_length=[4]) @test_util.run_in_graph_and_eager_modes - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testTensorArrayStateIsAccepted(self): cell = TensorArrayStateRNNCell() in_eager_mode = context.executing_eagerly() diff --git a/tensorflow/python/kernel_tests/scatter_nd_ops_test.py b/tensorflow/python/kernel_tests/scatter_nd_ops_test.py index c1241ba87ee..8510a08f0c9 100644 --- a/tensorflow/python/kernel_tests/scatter_nd_ops_test.py +++ b/tensorflow/python/kernel_tests/scatter_nd_ops_test.py @@ -217,7 +217,7 @@ class StatefulScatterNdTest(test.TestCase): def testVariableRankAdd(self): self._VariableRankTests(_NumpyAdd, state_ops.scatter_nd_add) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testVariableRankSub(self): self._VariableRankTests(_NumpySub, state_ops.scatter_nd_sub) @@ -235,7 +235,7 @@ class StatefulScatterNdTest(test.TestCase): self._VariableRankTest( np_scatter, tf_scatter, vtype, itype, repeat_indices=True) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testScatterRepeatIndices(self): """This tests scatter_add using indices that repeat.""" self._ScatterRepeatIndicesTest(_NumpyAdd, state_ops.scatter_nd_add) @@ -257,7 +257,7 @@ class StatefulScatterNdTest(test.TestCase): # session.run([update0, update1]) # self.assertAllEqual([False, True], self.evaluate(var)) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testScatterOutOfRangeCpu(self): # TODO(simister): Re-enable once binary size increase due to # scatter_nd ops is under control. @@ -294,7 +294,7 @@ class StatefulScatterNdTest(test.TestCase): state_ops.scatter_nd_update(ref, indices, updates).get_shape().as_list(), shape) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testResVarInvalidOutputShape(self): res = variables.Variable( initial_value=lambda: array_ops.zeros(shape=[], dtype=dtypes.float32), @@ -509,7 +509,7 @@ class ScatterNdTest(test.TestCase): ValueError, "Indices and updates specified for empty output shape"): self.scatter_nd(indices, updates, shape) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testEmptyOutputShape2(self): indices = array_ops.placeholder(dtypes.int32, shape=None) updates = array_ops.placeholder(dtypes.int32, shape=None) @@ -717,6 +717,7 @@ class ScatterNdTensorTest(test.TestCase): self.assertAllEqual(subbed, constant_op.constant([1, -10, 1, -9, -8, 1, 1, -11])) + @test_util.run_v1_only("b/120545219") def testUpdateAddSubGradients(self): with self.cached_session(): diff --git a/tensorflow/python/kernel_tests/self_adjoint_eig_op_test.py b/tensorflow/python/kernel_tests/self_adjoint_eig_op_test.py index ce782dbc28b..47b22ec2967 100644 --- a/tensorflow/python/kernel_tests/self_adjoint_eig_op_test.py +++ b/tensorflow/python/kernel_tests/self_adjoint_eig_op_test.py @@ -22,6 +22,7 @@ import numpy as np from tensorflow.python.framework import constant_op from tensorflow.python.framework import dtypes as dtypes_lib +from tensorflow.python.framework import test_util from tensorflow.python.ops import array_ops from tensorflow.python.ops import gradient_checker_v2 from tensorflow.python.ops import linalg_ops @@ -39,6 +40,7 @@ def _AddTest(test_class, op_name, testcase_name, fn): class SelfAdjointEigTest(test.TestCase): + @test_util.run_deprecated_v1 def testWrongDimensions(self): # The input to self_adjoint_eig should be a tensor of # at least rank 2. @@ -49,6 +51,7 @@ class SelfAdjointEigTest(test.TestCase): with self.assertRaises(ValueError): linalg_ops.self_adjoint_eig(vector) + @test_util.run_deprecated_v1 def testConcurrentExecutesWithoutError(self): all_ops = [] with self.session(use_gpu=True) as sess: diff --git a/tensorflow/python/kernel_tests/session_ops_test.py b/tensorflow/python/kernel_tests/session_ops_test.py index dc663cb091c..bc5d8e81511 100644 --- a/tensorflow/python/kernel_tests/session_ops_test.py +++ b/tensorflow/python/kernel_tests/session_ops_test.py @@ -20,6 +20,7 @@ from __future__ import print_function from tensorflow.python.framework import constant_op from tensorflow.python.framework import dtypes from tensorflow.python.framework import ops +from tensorflow.python.framework import test_util from tensorflow.python.ops import array_ops from tensorflow.python.ops import math_ops from tensorflow.python.ops import session_ops @@ -28,6 +29,7 @@ from tensorflow.python.ops import variables from tensorflow.python.platform import test +@test_util.run_v1_only("b/120545219") class SessionOpsTest(test.TestCase): def testHandleBasic(self): @@ -232,6 +234,7 @@ class SessionOpsTest(test.TestCase): b_p: b_handle.handle}) self.assertEqual(3.0, c_handle.eval()) + @test_util.run_v1_only("b/120545219") def testFeedOneHandleDirectly(self): with self.cached_session() as sess: a = constant_op.constant(10.0) @@ -243,6 +246,7 @@ class SessionOpsTest(test.TestCase): self.assertAllClose(2500.0, sess.run(d, feed_dict={c: h_c})) + @test_util.run_v1_only("b/120545219") def testDirectHandleFeedOverlappingWithFetches(self): with self.cached_session() as sess: a = constant_op.constant(10.0) @@ -283,6 +287,7 @@ class SessionOpsTest(test.TestCase): self.assertAllClose(48.0, sess.run(e, feed_dict={c: h_c, d: h_d})) self.assertAllClose(-48.0, sess.run(e, feed_dict={c: h_d, d: h_c})) + @test_util.run_v1_only("b/120545219") def testFeedHandleToVariableDirectly(self): with self.cached_session() as sess: a = variables.Variable(12.0) diff --git a/tensorflow/python/kernel_tests/signal/reconstruction_ops_test.py b/tensorflow/python/kernel_tests/signal/reconstruction_ops_test.py index 4cb6cedee99..e0ce06418a4 100644 --- a/tensorflow/python/kernel_tests/signal/reconstruction_ops_test.py +++ b/tensorflow/python/kernel_tests/signal/reconstruction_ops_test.py @@ -66,6 +66,7 @@ class ReconstructionOpsTest(test.TestCase): self.assertAllClose(output, expected_output) + @test_util.run_deprecated_v1 def test_unknown_shapes(self): # This test uses placeholders and does not work in eager mode. if context.executing_eagerly(): @@ -85,6 +86,7 @@ class ReconstructionOpsTest(test.TestCase): self.assertAllClose(output, expected_output) + @test_util.run_deprecated_v1 def test_unknown_rank(self): # This test uses placeholders and does not work in eager mode. if context.executing_eagerly(): @@ -104,6 +106,7 @@ class ReconstructionOpsTest(test.TestCase): self.assertAllClose(output, expected_output) + @test_util.run_deprecated_v1 def test_fast_path(self): # This test uses tensor names and does not work in eager mode. if context.executing_eagerly(): diff --git a/tensorflow/python/kernel_tests/sparse_conditional_accumulator_test.py b/tensorflow/python/kernel_tests/sparse_conditional_accumulator_test.py index 275c86e5349..4a967b65628 100644 --- a/tensorflow/python/kernel_tests/sparse_conditional_accumulator_test.py +++ b/tensorflow/python/kernel_tests/sparse_conditional_accumulator_test.py @@ -267,7 +267,7 @@ class IndexedSlicesConditionalAccumulatorTest(test.TestCase): self.assertAllEqual(val.values, [[5, 5], [0, 20], [30, 0]]) self.assertAllEqual(val.dense_shape, [-1, 2]) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testParallelApplyGradMean(self): with self.cached_session() as sess: q = data_flow_ops.SparseConditionalAccumulator( @@ -299,7 +299,7 @@ class IndexedSlicesConditionalAccumulatorTest(test.TestCase): np.array([[expected_val, 0], [0, expected_val]]).astype(np.float32), val, sess) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testParallelApplyGradSum(self): with self.cached_session() as sess: q = data_flow_ops.SparseConditionalAccumulator( @@ -334,7 +334,7 @@ class IndexedSlicesConditionalAccumulatorTest(test.TestCase): np.array([[expected_val, 0], [0, expected_val]]).astype(np.float32), val, sess) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testParallelTakeGrad(self): with self.cached_session() as sess: q = data_flow_ops.SparseConditionalAccumulator( @@ -374,7 +374,7 @@ class IndexedSlicesConditionalAccumulatorTest(test.TestCase): self._assertEqual_nparray( np.array([[0, 0], [elems[i], 0]]), results[i], sess) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testAccumulatorApplyAndBlockingTake(self): with self.cached_session() as sess: q = data_flow_ops.SparseConditionalAccumulator( @@ -410,7 +410,7 @@ class IndexedSlicesConditionalAccumulatorTest(test.TestCase): with self.assertRaisesOpError("was cancelled"): self.evaluate(takeg_op) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testAccumulatorCancel(self): with self.cached_session() as sess: q = data_flow_ops.SparseConditionalAccumulator( @@ -430,7 +430,7 @@ class IndexedSlicesConditionalAccumulatorTest(test.TestCase): takeg_thread.join() - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testNonVectorIndices(self): with self.cached_session(): q = data_flow_ops.SparseConditionalAccumulator( @@ -443,7 +443,7 @@ class IndexedSlicesConditionalAccumulatorTest(test.TestCase): grad_indices=[[0, 1], [1, 0]], grad_values=np.array([1, 2]).astype(np.float32)).run() - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testZeroDimensionValues(self): with self.cached_session(): q = data_flow_ops.SparseConditionalAccumulator( @@ -454,7 +454,7 @@ class IndexedSlicesConditionalAccumulatorTest(test.TestCase): q.apply_grad( grad_indices=[0], grad_values=np.array(1).astype(np.float32)).run() - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testWrongNonEmptyInputValues(self): with self.cached_session(): q = data_flow_ops.SparseConditionalAccumulator( @@ -466,7 +466,7 @@ class IndexedSlicesConditionalAccumulatorTest(test.TestCase): grad_indices=[0, 1], grad_values=np.array([[0, 1, 1]]).astype(np.float32)).run() - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testDynamicNonVectorIndices(self): with self.cached_session() as sess: q = data_flow_ops.SparseConditionalAccumulator( @@ -486,7 +486,7 @@ class IndexedSlicesConditionalAccumulatorTest(test.TestCase): x_values: np.array([1, 2]).astype(np.float32) }) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testDynamicWrongNonEmptyInputValues(self): with self.cached_session() as sess: q = data_flow_ops.SparseConditionalAccumulator( @@ -505,7 +505,7 @@ class IndexedSlicesConditionalAccumulatorTest(test.TestCase): x_values: np.array([[0, 1, 1]]).astype(np.float32) }) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testEmptyShapeApply(self): with self.cached_session(): q = data_flow_ops.SparseConditionalAccumulator( @@ -531,7 +531,7 @@ class IndexedSlicesConditionalAccumulatorTest(test.TestCase): q.apply_grad(grad_indices=[0], grad_values=[1.0], grad_shape=[]).run() q.apply_grad(grad_indices=[0], grad_values=[1.0]).run() - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testValidateShape(self): with self.cached_session() as sess: q = data_flow_ops.SparseConditionalAccumulator( diff --git a/tensorflow/python/kernel_tests/stack_ops_test.py b/tensorflow/python/kernel_tests/stack_ops_test.py index d50f3f46806..1930d2484fd 100644 --- a/tensorflow/python/kernel_tests/stack_ops_test.py +++ b/tensorflow/python/kernel_tests/stack_ops_test.py @@ -96,7 +96,7 @@ class StackOpTest(test.TestCase): c1, b1, [r, v], [r.get_shape(), tensor_shape.unknown_shape()]) self.assertAllClose(np.ones(2000) * 10.0, self.evaluate(ry)) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testStackWhileSwap(self): self._testStackWhileSwap(use_gpu=False) self._testStackWhileSwap(use_gpu=True) @@ -248,7 +248,7 @@ class StackOpRefTest(test.TestCase): c1, b1, [r, v], [r.get_shape(), tensor_shape.unknown_shape()]) self.assertAllClose(np.ones(2000) * 10.0, self.evaluate(ry)) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testStackWhileSwap(self): self._testStackWhileSwap(use_gpu=False) self._testStackWhileSwap(use_gpu=True) diff --git a/tensorflow/python/kernel_tests/svd_op_test.py b/tensorflow/python/kernel_tests/svd_op_test.py index 94155fd1179..cfa9f122d1f 100644 --- a/tensorflow/python/kernel_tests/svd_op_test.py +++ b/tensorflow/python/kernel_tests/svd_op_test.py @@ -22,6 +22,7 @@ import numpy as np from tensorflow.python import tf2 from tensorflow.python.framework import constant_op +from tensorflow.python.framework import test_util from tensorflow.python.ops import array_ops from tensorflow.python.ops import gradient_checker from tensorflow.python.ops import linalg_ops @@ -39,6 +40,7 @@ def _AddTest(test_class, op_name, testcase_name, fn): class SvdOpTest(test.TestCase): + @test_util.run_v1_only("b/120545219") def testWrongDimensions(self): # The input to svd should be a tensor of at least rank 2. scalar = constant_op.constant(1.) @@ -50,6 +52,7 @@ class SvdOpTest(test.TestCase): "Shape must be at least rank 2 but is rank 1"): linalg_ops.svd(vector) + @test_util.run_v1_only("b/120545219") def testConcurrentExecutesWithoutError(self): with self.session(use_gpu=True) as sess: all_ops = [] @@ -126,6 +129,7 @@ def _GetSvdOpTest(dtype_, shape_, use_static_shape_, compute_uv_, identity = array_ops.matrix_band_part(array_ops.ones_like(xx), 0, 0) self.assertAllClose(identity, xx, atol=tol) + @test_util.run_v1_only("b/120545219") def Test(self): is_complex = dtype_ in (np.complex64, np.complex128) is_single = dtype_ in (np.float32, np.complex64) @@ -214,6 +218,7 @@ def _GetSvdGradOpTest(dtype_, shape_, compute_uv_, full_matrices_): tf_v *= phase[..., :n] return tf_s, tf_u, tf_v + @test_util.run_v1_only("b/120545219") def Test(self): np.random.seed(42) a = np.random.uniform(low=-1.0, high=1.0, size=shape_).astype(dtype_) diff --git a/tensorflow/python/kernel_tests/tensor_array_ops_test.py b/tensorflow/python/kernel_tests/tensor_array_ops_test.py index 884c04eb7ac..88625841bcc 100644 --- a/tensorflow/python/kernel_tests/tensor_array_ops_test.py +++ b/tensorflow/python/kernel_tests/tensor_array_ops_test.py @@ -309,7 +309,7 @@ class TensorArrayTest(test.TestCase): self._testTensorArraySplitRead(dtypes.string) @test_util.disable_control_flow_v2("v2 does not support TensorArray.grad.") - @test_util.run_deprecated_v1 + @test_util.run_v1_only("v2 does not support TensorArray.grad.") def testSkipEagerTensorGradArrayWriteRead(self): with self.session(use_gpu=True) as session: ta = tensor_array_ops.TensorArray( @@ -364,7 +364,7 @@ class TensorArrayTest(test.TestCase): self.assertAllEqual([2.0], session.run(g2)) @test_util.disable_control_flow_v2("v2 does not support TensorArray.grad.") - @test_util.run_deprecated_v1 + @test_util.run_v1_only("v2 does not support TensorArray.grad.") def testSkipEagerTensorGradArrayDynamicWriteRead(self): with self.session(use_gpu=True) as session: ta = tensor_array_ops.TensorArray( @@ -407,7 +407,7 @@ class TensorArrayTest(test.TestCase): self.assertAllEqual(3, g_vs) @test_util.disable_control_flow_v2("v2 does not support TensorArray.grad.") - @test_util.run_deprecated_v1 + @test_util.run_v1_only("v2 does not support TensorArray.grad.") def testSkipEagerTensorGradAccessTwiceReceiveSameObject(self): with self.session(use_gpu=True) as session: ta = tensor_array_ops.TensorArray( @@ -424,7 +424,7 @@ class TensorArrayTest(test.TestCase): self.assertAllEqual(t_g_ta_0, t_g_ta_1) self.assertAllEqual([[4.0, 5.0]], d_r1_0) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testTensorArrayWriteWrongIndexOrDataTypeFails(self): with self.session(use_gpu=True): ta = _make_ta(3, "foo", dtype=dtypes.float32) @@ -458,7 +458,7 @@ class TensorArrayTest(test.TestCase): with self.assertRaisesOpError(error_msg): self.evaluate(ta.write(3, 3.0).flow) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testTensorArrayReadWrongIndexOrDataTypeFails(self): with self.session(use_gpu=True): ta = _make_ta(3, "foo", dtype=dtypes.float32) @@ -493,7 +493,7 @@ class TensorArrayTest(test.TestCase): self.evaluate(ta.read(3)) @test_util.disable_control_flow_v2("v2 allows multiple writes.") - @test_util.run_deprecated_v1 + @test_util.run_v1_only("v2 allows multiple writes.") def testSkipEagerTensorArrayWriteMultipleFails(self): with self.session(use_gpu=True): ta = tensor_array_ops.TensorArray( @@ -504,7 +504,7 @@ class TensorArrayTest(test.TestCase): "it has already been written to."): self.evaluate(ta.write(2, 3.0).write(2, 3.0).flow) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testTensorArrayConcatIncompatibleShapesFails(self): with self.session(use_gpu=True): ta = tensor_array_ops.TensorArray( @@ -536,7 +536,7 @@ class TensorArrayTest(test.TestCase): with self.assertRaisesOpError("shape"): self.evaluate(w3.concat()) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testTensorArraySplitIncompatibleShapesFails(self): with self.session(use_gpu=True): in_eager_mode = context.executing_eagerly() @@ -611,14 +611,14 @@ class TensorArrayTest(test.TestCase): wb1_grad.flow.eval() @test_util.disable_control_flow_v2("v2 does not support TensorArray.grad.") - @test_util.run_deprecated_v1 + @test_util.run_v1_only("v2 does not support TensorArray.grad.") def testSkipEagerTensorArrayWriteGradientAddMultipleAdds(self): for dtype in (dtypes.int32, dtypes.int64, dtypes.float32, dtypes.float64, dtypes.complex64, dtypes.complex128): self._testTensorArrayWriteGradientAddMultipleAdds(dtype) @test_util.disable_control_flow_v2("Low level legacy TA op test.") - @test_util.run_deprecated_v1 + @test_util.run_v1_only("Low level legacy TA op test.") def testSkipEagerTensorArrayGradWithShapeKnownElementShape(self): with self.session(use_gpu=True) as sess: ta = tensor_array_ops.TensorArray( @@ -649,7 +649,7 @@ class TensorArrayTest(test.TestCase): sess.run(read_value, feed_dict={value: fed_value})) @test_util.disable_control_flow_v2("Low level legacy TA op test.") - @test_util.run_deprecated_v1 + @test_util.run_v1_only("Low level legacy TA op test.") def testSkipEagerTensorArrayGradWithShapeUnknownElementShape(self): with self.session(use_gpu=True) as sess: ta = tensor_array_ops.TensorArray( @@ -778,7 +778,7 @@ class TensorArrayTest(test.TestCase): self._testTensorArrayGradientWritePackConcatAndRead() @test_util.disable_control_flow_v2("v2 does not support clear_after_read.") - @test_util.run_deprecated_v1 + @test_util.run_v1_only("v2 does not support clear_after_read.") def testTensorArrayReadTwice(self): with self.session(use_gpu=True): value = constant_op.constant([[1.0, -1.0], [10.0, -10.0]]) @@ -1351,7 +1351,7 @@ class TensorArrayTest(test.TestCase): .ENABLE_TENSOR_ARRAY_V2 else v1_msg): ta.stack().eval() - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testSkipEagerTensorArrayEvalEmpty(self): self._testTensorArrayEvalEmpty() @@ -1443,7 +1443,7 @@ class TensorArrayTest(test.TestCase): self.assertAllEqual(expected_grad, grad_vals[0]) @test_util.disable_control_flow_v2("colocate_with not supported in v2.") - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testSkipEagerTensorArrayGetsDeviceFromFirstWrite(self): with ops.device("/job:worker/task:0/cpu:0"): # this initial device will be ignored. @@ -1493,7 +1493,7 @@ class TensorArrayTest(test.TestCase): [s for s in dev_stats[d] if "/TensorArray" in s.node_name]) @test_util.disable_control_flow_v2("colocate_with not supported in v2.") - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testSkipEagerTensorArrayGetsDeviceFromFirstWriteInWhileLoop(self): with ops.device("/job:worker/task:0/cpu:0"): ta = tensor_array_ops.TensorArray(dtype=dtypes.float32, size=2) @@ -1524,7 +1524,7 @@ class TensorArrayTest(test.TestCase): [s for s in dev_stats[d] if "TensorArray" == s.node_name]) @test_util.disable_control_flow_v2("colocate_with not supported in v2.") - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testSkipEagerTensorArrayDisabledColocateWithFirstWriteCall(self): with ops.device("/job:worker/task:0/cpu:0"): ta = tensor_array_ops.TensorArray( diff --git a/tensorflow/python/kernel_tests/tensordot_op_test.py b/tensorflow/python/kernel_tests/tensordot_op_test.py index 2894b7dd50f..febfe23b16d 100644 --- a/tensorflow/python/kernel_tests/tensordot_op_test.py +++ b/tensorflow/python/kernel_tests/tensordot_op_test.py @@ -24,6 +24,7 @@ from tensorflow.python import tf2 from tensorflow.python.framework import constant_op from tensorflow.python.framework import dtypes from tensorflow.python.framework import errors_impl +from tensorflow.python.framework import test_util from tensorflow.python.ops import array_ops from tensorflow.python.ops import math_ops from tensorflow.python.platform import test as test_lib @@ -40,6 +41,7 @@ def _add_test(test, test_name, fn): class TensordotTest(test_lib.TestCase): + @test_util.run_v1_only("b/120545219") def test_invalid_shape(self): a = [[1, 2], [3, 4]] b = [[1, 2], [3, 4], [5, 6]] @@ -63,6 +65,7 @@ class TensordotTest(test_lib.TestCase): axes_ph: (a_axes, b_axes) }) + @test_util.run_v1_only("b/120545219") def test_invalid_axes(self): a = [[1, 2], [3, 4]] b = [[1, 2], [3, 4]] @@ -105,6 +108,7 @@ class TensordotTest(test_lib.TestCase): self.assertAllEqual(tf_ans.shape, np_ans.shape) self.assertAllEqual(tf_ans, np_ans) + @test_util.run_v1_only("b/120545219") def test_partial_shape_inference(self): for axes in ([1], [0]), 1: a = array_ops.placeholder(dtypes.float32) diff --git a/tensorflow/python/kernel_tests/unicode_encode_op_test.py b/tensorflow/python/kernel_tests/unicode_encode_op_test.py index a5a5c2017c6..72c8a267665 100644 --- a/tensorflow/python/kernel_tests/unicode_encode_op_test.py +++ b/tensorflow/python/kernel_tests/unicode_encode_op_test.py @@ -24,6 +24,7 @@ import numpy as np from tensorflow.python.framework import constant_op from tensorflow.python.framework import errors_impl as errors from tensorflow.python.framework import ops +from tensorflow.python.framework import test_util from tensorflow.python.ops.ragged import ragged_factory_ops from tensorflow.python.ops.ragged import ragged_string_ops from tensorflow.python.platform import test @@ -58,6 +59,7 @@ class UnicodeEncodeOpTest(test.TestCase, parameterized.TestCase): ragged_string_ops.unicode_encode(test_value, encoding, "strict").eval() @parameterized.parameters("UTF-8", "UTF-16-BE", "UTF-32-BE") + @test_util.run_v1_only("b/120545219") def testIgnoreErrors(self, encoding): test_value = np.array([72, 101, 2147483647, -1, 111], np.int32) expected_value = u"Heo".encode(encoding) @@ -69,6 +71,7 @@ class UnicodeEncodeOpTest(test.TestCase, parameterized.TestCase): self.assertAllEqual(result, expected_value) @parameterized.parameters("UTF-8", "UTF-16-BE", "UTF-32-BE") + @test_util.run_v1_only("b/120545219") def testReplaceErrors(self, encoding): test_value = np.array([72, 101, 2147483647, -1, 111], np.int32) expected_value = u"He\U0000fffd\U0000fffdo".encode(encoding) @@ -109,6 +112,7 @@ class UnicodeEncodeOpTest(test.TestCase, parameterized.TestCase): # -- regular Tensor tests -- # @parameterized.parameters("UTF-8", "UTF-16-BE", "UTF-32-BE") + @test_util.run_v1_only("b/120545219") def testVector(self, encoding): test_value = np.array([72, 101, 108, 108, 111], np.int32) expected_value = u"Hello".encode(encoding) @@ -144,6 +148,7 @@ class UnicodeEncodeOpTest(test.TestCase, parameterized.TestCase): self.assertAllEqual(result, expected_value) @parameterized.parameters("UTF-8", "UTF-16-BE", "UTF-32-BE") + @test_util.run_v1_only("b/120545219") def testMatrix(self, encoding): test_value = np.array( [[72, 128516, 108, 108, 111], [87, 128516, 114, 108, 100]], np.int32) @@ -157,6 +162,7 @@ class UnicodeEncodeOpTest(test.TestCase, parameterized.TestCase): self.assertAllEqual(result, expected_value) @parameterized.parameters("UTF-8", "UTF-16-BE", "UTF-32-BE") + @test_util.run_v1_only("b/120545219") def test3DimMatrix(self, encoding): test_value = constant_op.constant( [[[72, 101, 108, 108, 111], [87, 111, 114, 108, 100]], @@ -172,6 +178,7 @@ class UnicodeEncodeOpTest(test.TestCase, parameterized.TestCase): self.assertAllEqual(result, expected_value) @parameterized.parameters("UTF-8", "UTF-16-BE", "UTF-32-BE") + @test_util.run_v1_only("b/120545219") def test4DimMatrix(self, encoding): test_value = constant_op.constant( [[[[72, 101, 108, 108, 111]], [[87, 111, 114, 108, 100]]], @@ -192,6 +199,7 @@ class UnicodeEncodeOpTest(test.TestCase, parameterized.TestCase): # -- Ragged Tensor tests -- # @parameterized.parameters("UTF-8", "UTF-16-BE", "UTF-32-BE") + @test_util.run_v1_only("b/120545219") def testRaggedMatrix(self, encoding): test_value = ragged_factory_ops.constant( [[72, 195, 108, 108, 111], [87, 128516, 114, 108, 100, 46]], np.int32) @@ -205,6 +213,7 @@ class UnicodeEncodeOpTest(test.TestCase, parameterized.TestCase): self.assertAllEqual(result, expected_value) @parameterized.parameters("UTF-8", "UTF-16-BE", "UTF-32-BE") + @test_util.run_v1_only("b/120545219") def test3DimMatrixWithRagged2ndDim(self, encoding): test_value = ragged_factory_ops.constant( [[[72, 101, 108, 108, 111], [87, 111, 114, 108, 100]], @@ -224,6 +233,7 @@ class UnicodeEncodeOpTest(test.TestCase, parameterized.TestCase): self.assertAllEqual(result.tolist(), expected_value) @parameterized.parameters("UTF-8", "UTF-16-BE", "UTF-32-BE") + @test_util.run_v1_only("b/120545219") def test3DimMatrixWithRagged3rdDim(self, encoding): test_value = ragged_factory_ops.constant( [[[72, 101, 108, 108, 111], [87, 111, 114, 108, 100, 46]], @@ -241,6 +251,7 @@ class UnicodeEncodeOpTest(test.TestCase, parameterized.TestCase): self.assertAllEqual(result.tolist(), expected_value) @parameterized.parameters("UTF-8", "UTF-16-BE", "UTF-32-BE") + @test_util.run_v1_only("b/120545219") def test3DimMatrixWithRagged2ndAnd3rdDim(self, encoding): test_value = ragged_factory_ops.constant( [[[72, 101, 108, 108, 111], [87, 111, 114, 108, 100, 46]], [], @@ -254,6 +265,7 @@ class UnicodeEncodeOpTest(test.TestCase, parameterized.TestCase): self.assertAllEqual(result.tolist(), expected_value) @parameterized.parameters("UTF-8", "UTF-16-BE", "UTF-32-BE") + @test_util.run_v1_only("b/120545219") def test4DimRaggedMatrix(self, encoding): test_value = ragged_factory_ops.constant( [[[[72, 101, 108, 108, 111], [87, 111, 114, 108, 100]]], @@ -267,6 +279,7 @@ class UnicodeEncodeOpTest(test.TestCase, parameterized.TestCase): self.assertAllEqual(result.tolist(), expected_value) @parameterized.parameters("UTF-8", "UTF-16-BE", "UTF-32-BE") + @test_util.run_v1_only("b/120545219") def testRaggedMatrixWithMultiDimensionInnerValues(self, encoding): test_inner_values = constant_op.constant([[[72, 101, 108, 108, 111], [87, 111, 114, 108, 100]], diff --git a/tensorflow/python/kernel_tests/variables_test.py b/tensorflow/python/kernel_tests/variables_test.py index 08d885e8a87..336e9b0bca2 100644 --- a/tensorflow/python/kernel_tests/variables_test.py +++ b/tensorflow/python/kernel_tests/variables_test.py @@ -43,7 +43,7 @@ from tensorflow.python.util import compat class VariablesTestCase(test.TestCase): - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testInitialization(self): with self.cached_session(): var0 = variables.VariableV1(0.0) @@ -71,7 +71,7 @@ class VariablesTestCase(test.TestCase): self.assertAllClose(0.0, self.evaluate(var0)) self.assertAllClose(1.1, self.evaluate(var1)) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testInitializationOrder(self): with self.cached_session(): rnd = variables.Variable(random_ops.random_uniform([3, 6]), name="rnd") @@ -194,7 +194,7 @@ class VariablesTestCase(test.TestCase): def testCountUpToInt64(self): self._countUpToTest(dtypes.int64) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testControlDepsNone(self): with self.cached_session(): c = constant_op.constant(1.0) @@ -208,7 +208,7 @@ class VariablesTestCase(test.TestCase): self.assertEqual([], var_x.value().op.control_inputs) self.assertEqual([], var_x._ref().op.control_inputs) # pylint: disable=protected-access - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testControlFlow(self): with self.cached_session() as sess: v0 = variables.Variable(0, name="v0") @@ -245,7 +245,7 @@ class VariablesTestCase(test.TestCase): self.evaluate(v0.initializer) self.evaluate(add) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testControlFlowInitialization(self): """Expects an error if an initializer is in a control-flow scope.""" def cond(i, _): @@ -412,7 +412,7 @@ class VariablesTestCase(test.TestCase): variables.global_variables_initializer().run() self.assertAllClose([1, 12], self.evaluate(var)) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testColocation(self): with ops.device("/job:ps"): var = variables.VariableV1(0, name="v") @@ -421,7 +421,7 @@ class VariablesTestCase(test.TestCase): self.assertDeviceEqual("/job:ps", assign_op.device) self.assertEqual([b"loc:@v"], assign_op.op.colocation_groups()) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testInitializerFunction(self): value = [[-42], [133.7]] shape = [2, 1] @@ -459,7 +459,7 @@ class VariablesTestCase(test.TestCase): lambda: constant_op.constant(1.), constraint=constraint) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testNoRefDataRace(self): with self.cached_session(): a = variables.Variable([1, 2, 3], dtype=dtypes.float32) @@ -489,7 +489,7 @@ class VariablesTestCase(test.TestCase): for i in v2.initializer.inputs: self.assertEqual(expected_group_v2, i.op.colocation_groups()) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testVariableDefInitializedInstances(self): with ops.Graph().as_default(), self.cached_session() as sess: v_def = variables.Variable( @@ -542,7 +542,7 @@ class VariablesTestCase(test.TestCase): self.assertAllClose(np.ones((5, 5), np.float32), self.evaluate(var)) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testRepr(self): var = variables.VariableV1(np.zeros((5, 5), np.float32), name="noop") self.assertEqual( @@ -576,7 +576,7 @@ class IsInitializedTest(test.TestCase): variables.global_variables_initializer().run() self.assertEqual(0, self.evaluate(uninited).size) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testVariableList(self): with ops.Graph().as_default(), self.cached_session() as sess: v = variables.VariableV1([1, 2], name="v") @@ -614,7 +614,7 @@ class ObsoleteIsInitializedTest(test.TestCase): with ops.Graph().as_default(): self.assertEqual(None, variables.assert_variables_initialized()) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testVariables(self): with ops.Graph().as_default(), self.cached_session() as sess: v = variables.VariableV1([1, 2]) @@ -626,7 +626,7 @@ class ObsoleteIsInitializedTest(test.TestCase): variables.global_variables_initializer().run() self.evaluate(inited) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testVariableList(self): with ops.Graph().as_default(), self.cached_session() as sess: v = variables.VariableV1([1, 2]) diff --git a/tensorflow/python/kernel_tests/while_v2_test.py b/tensorflow/python/kernel_tests/while_v2_test.py index d155544f3e7..cae459a34e9 100644 --- a/tensorflow/python/kernel_tests/while_v2_test.py +++ b/tensorflow/python/kernel_tests/while_v2_test.py @@ -53,6 +53,7 @@ class WhileV2Test(test.TestCase, parameterized.TestCase): self.assertEqual(self.evaluate(ret), 16.) self.assertSequenceEqual(self.evaluate(grad), [32.]) + @test_util.run_v1_only("b/120545219") def testReturnSameStructureTrue(self): x = constant_op.constant(2.) ret = while_loop_v2( @@ -145,7 +146,7 @@ class WhileV2Test(test.TestCase, parameterized.TestCase): self.assertSequenceEqual(self.evaluate(grad), [32.]) self.assertSequenceEqual(self.evaluate(grad_grad), [48.]) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testPruning(self): x = constant_op.constant(1) @@ -441,6 +442,7 @@ class WhileV2Test(test.TestCase, parameterized.TestCase): # grad = gradients_impl.gradients(output, [n]) # self.assertEqual(self.evaluate(grad), 3.5) + @test_util.run_deprecated_v1 def testForwardPassRewrite(self): x = constant_op.constant(1.0, name="x") output = while_v2.while_loop(lambda x: x < 10.0, diff --git a/tensorflow/python/layers/normalization_test.py b/tensorflow/python/layers/normalization_test.py index 07d8e40b759..6535f74129a 100644 --- a/tensorflow/python/layers/normalization_test.py +++ b/tensorflow/python/layers/normalization_test.py @@ -38,6 +38,7 @@ from tensorflow.python.training import gradient_descent from tensorflow.python.training import saver as saver_lib +@test_util.run_v1_only('b/120545219') class BNTest(test.TestCase): def _simple_model(self, image, fused, freeze_mode): @@ -144,7 +145,6 @@ class BNTest(test.TestCase): return train_vars, loss_val - @test_util.run_deprecated_v1 def testHalfPrecision(self): ref_vars, ref_loss = self._trainEvalSequence( dtype=dtypes.float32, @@ -230,43 +230,33 @@ class BNTest(test.TestCase): ckpt_b_use_gpu, use_gpu_test_a, use_gpu_test_b, freeze_mode) - @test_util.run_deprecated_v1 def testCheckpointFusedCPUAndFusedGPU(self): self._testCheckpointCrossDevice(True, False, True, True) - @test_util.run_deprecated_v1 def testCheckpointFusedCPUAndFusedCPU(self): self._testCheckpointCrossDevice(True, False, True, False) - @test_util.run_deprecated_v1 def testCheckpointFusedGPUAndFusedGPU(self): self._testCheckpointCrossDevice(True, True, True, True) - @test_util.run_deprecated_v1 def testCheckpointNonFusedCPUAndNonFusedGPU(self): self._testCheckpointCrossDevice(False, False, False, True) - @test_util.run_deprecated_v1 def testCheckpointNonFusedCPUAndNonFusedCPU(self): self._testCheckpointCrossDevice(False, False, False, False) - @test_util.run_deprecated_v1 def testCheckpointNonFusedGPUAndNonFusedGPU(self): self._testCheckpointCrossDevice(False, True, False, True) - @test_util.run_deprecated_v1 def testCheckpointNonFusedGPUAndFusedGPU(self): self._testCheckpointCrossDevice(False, True, True, True) - @test_util.run_deprecated_v1 def testCheckpointNonFusedGPUAndFusedCPU(self): self._testCheckpointCrossDevice(False, True, True, False) - @test_util.run_deprecated_v1 def testCheckpointNonFusedCPUAndFusedCPU(self): self._testCheckpointCrossDevice(False, False, True, False) - @test_util.run_deprecated_v1 def testCreateBN(self): # Call layer. bn = normalization_layers.BatchNormalization(axis=1) @@ -293,7 +283,6 @@ class BNTest(test.TestCase): ops.get_collection(ops.GraphKeys.TRAINABLE_VARIABLES), bn.trainable_variables) - @test_util.run_deprecated_v1 def testCreateFusedBNFloat16(self): # Call layer. bn = normalization_layers.BatchNormalization(axis=1, fused=True) @@ -323,7 +312,6 @@ class BNTest(test.TestCase): ops.get_collection(ops.GraphKeys.TRAINABLE_VARIABLES), bn.trainable_variables) - @test_util.run_deprecated_v1 def test3DInputAxis1(self): epsilon = 1e-3 bn = normalization_layers.BatchNormalization( @@ -367,7 +355,6 @@ class BNTest(test.TestCase): self.assertAlmostEqual(np.mean(normed_np_output), 0., places=1) self.assertAlmostEqual(np.std(normed_np_output), 1., places=1) - @test_util.run_deprecated_v1 def test3DInputAxis2(self): epsilon = 1e-3 bn = normalization_layers.BatchNormalization( @@ -451,7 +438,6 @@ class BNTest(test.TestCase): self.assertAlmostEqual(np.mean(normed_np_output), 0., places=1) self.assertAlmostEqual(np.std(normed_np_output), 1., places=1) - @test_util.run_deprecated_v1 def test4DInputAxis2(self): epsilon = 1e-3 bn = normalization_layers.BatchNormalization( @@ -493,7 +479,6 @@ class BNTest(test.TestCase): self.assertAlmostEqual(np.mean(normed_np_output), 0., places=1) self.assertAlmostEqual(np.std(normed_np_output), 1., places=1) - @test_util.run_deprecated_v1 def test4DInputAxis3(self): epsilon = 1e-3 bn = normalization_layers.BatchNormalization( @@ -535,7 +520,6 @@ class BNTest(test.TestCase): self.assertAlmostEqual(np.mean(normed_np_output), 0., places=1) self.assertAlmostEqual(np.std(normed_np_output), 1., places=1) - @test_util.run_deprecated_v1 def test4DInputAxis3Fused(self): epsilon = 1e-3 bn = normalization_layers.BatchNormalization( @@ -619,7 +603,6 @@ class BNTest(test.TestCase): self.assertAlmostEqual(np.mean(normed_np_output), 0., places=1) self.assertAlmostEqual(np.std(normed_np_output), 1., places=1) - @test_util.run_deprecated_v1 def testNegativeAxis(self): epsilon = 1e-3 bn = normalization_layers.BatchNormalization( @@ -662,7 +645,6 @@ class BNTest(test.TestCase): self.assertAlmostEqual(np.mean(normed_np_output), 0., places=1) self.assertAlmostEqual(np.std(normed_np_output), 1., places=1) - @test_util.run_deprecated_v1 def testBooleanLearningPhase(self): epsilon = 1e-3 bn = normalization_layers.BatchNormalization( @@ -703,7 +685,6 @@ class BNTest(test.TestCase): self.assertAlmostEqual(np.mean(normed_np_output), 0., places=1) self.assertAlmostEqual(np.std(normed_np_output), 1., places=1) - @test_util.run_deprecated_v1 def testFunctionalNoReuse(self): inputs = variables.Variable( np.random.random((5, 4, 3, 6)), dtype=dtypes.float32) @@ -756,7 +737,6 @@ class BNTest(test.TestCase): self.assertAlmostEqual(np.mean(normed_np_output), 0., places=1) self.assertAlmostEqual(np.std(normed_np_output), 1., places=1) - @test_util.run_deprecated_v1 def testFunctionalReuse(self): inputs1 = variables.Variable( np.random.random((5, 4, 3, 6)), dtype=dtypes.float32) @@ -821,7 +801,6 @@ class BNTest(test.TestCase): self.assertAlmostEqual(np.mean(normed_np_output), 0., places=2) self.assertAlmostEqual(np.std(normed_np_output), 1., places=1) - @test_util.run_deprecated_v1 def testFunctionalReuseFromScope(self): inputs = variables.Variable( np.random.random((5, 4, 3, 6)), dtype=dtypes.float32) @@ -836,7 +815,6 @@ class BNTest(test.TestCase): inputs, axis=-1, momentum=0.9, epsilon=epsilon, training=training) self.assertEqual(len(variables.global_variables()), 5) - @test_util.run_deprecated_v1 def testNoCenter(self): bn = normalization_layers.BatchNormalization(axis=1, center=False) inputs = random_ops.random_uniform((5, 4, 3), seed=1) @@ -852,7 +830,6 @@ class BNTest(test.TestCase): self.assertEqual(len(bn.trainable_variables), 1) self.assertEqual(len(bn.non_trainable_variables), 2) - @test_util.run_deprecated_v1 def testNoScale(self): bn = normalization_layers.BatchNormalization(axis=1, scale=False) inputs = random_ops.random_uniform((5, 4, 3), seed=1) @@ -868,7 +845,6 @@ class BNTest(test.TestCase): self.assertEqual(len(bn.trainable_variables), 1) self.assertEqual(len(bn.non_trainable_variables), 2) - @test_util.run_deprecated_v1 def testRegularizers(self): reg = lambda x: 0.1 * math_ops.reduce_sum(x) bn = normalization_layers.BatchNormalization(axis=1, beta_regularizer=reg) @@ -894,7 +870,6 @@ class BNTest(test.TestCase): self.assertEqual(bn.gamma_constraint, g_constraint) self.assertEqual(bn.beta_constraint, b_constraint) - @test_util.run_deprecated_v1 def testRenorm(self): shape = (4, 3) xt = array_ops.placeholder(dtypes.float32, shape) @@ -953,7 +928,6 @@ class BNTest(test.TestCase): self.assertAllClose(y_train, yt_val_train, atol=1e-5) self.assertAllClose(y_test, yt_val_test, atol=1e-5) - @test_util.run_deprecated_v1 def testAdjustment(self): shape = (4, 3) xt = array_ops.placeholder(dtypes.float32, shape) @@ -998,7 +972,6 @@ class BNTest(test.TestCase): self.assertAllClose(y_train, yt_val_train, atol=1e-5) self.assertAllClose(y_test, yt_val_test, atol=1e-5) - @test_util.run_deprecated_v1 def testRenormWithAdjustment(self): shape = (4, 3) xt = array_ops.placeholder(dtypes.float32, shape) @@ -1069,7 +1042,6 @@ class BNTest(test.TestCase): normalization_layers.batch_normalization( inp, virtual_batch_size=-1) - @test_util.run_deprecated_v1 def testGhostBNVirtualBatchFull(self): shape = [6, 5, 4, 3] inp = random_ops.random_uniform(shape, seed=1) @@ -1095,7 +1067,6 @@ class BNTest(test.TestCase): inp, virtual_batch_size=3) self.assertListEqual(out.shape.as_list(), shape) - @test_util.run_deprecated_v1 def testGhostBNUnknownBatchSize(self): np_shape = [10, 5, 4] tf_shape = [None, 5, 4] @@ -1111,7 +1082,6 @@ class BNTest(test.TestCase): self.assertListEqual(list(y.shape), np_shape) - @test_util.run_deprecated_v1 def testGhostBN2Dims(self): shape = [6, 2] virtual_batch_size = 3 @@ -1165,7 +1135,6 @@ class BNTest(test.TestCase): self.assertAllClose(y_train, y_val_train, atol=1e-5) self.assertAllClose(y_test, y_val_test, atol=1e-5) - @test_util.run_deprecated_v1 def testGhostBN4DimsAxis3(self): shape = [6, 10, 10, 3] virtual_batch_size = 2 @@ -1219,7 +1188,6 @@ class BNTest(test.TestCase): self.assertAllClose(y_train, y_val_train, atol=1e-2) self.assertAllClose(y_test, y_val_test, atol=1e-2) - @test_util.run_deprecated_v1 def testGhostBN4DimsAxis1(self): shape = [6, 3, 10, 10] virtual_batch_size = 2 @@ -1290,7 +1258,6 @@ class BNTest(test.TestCase): normalization_layers.batch_normalization( inp, axis=[1, 2, 1]) # duplicate - @test_util.run_deprecated_v1 def test3DInputMultiAxis12(self): epsilon = 1e-3 bn = normalization_layers.BatchNormalization( @@ -1332,7 +1299,6 @@ class BNTest(test.TestCase): self.assertAlmostEqual(np.mean(normed_np_output), 0., places=1) self.assertAlmostEqual(np.std(normed_np_output), 1., places=1) - @test_util.run_deprecated_v1 def test5DInputMultiAxis123(self): epsilon = 1e-3 bn = normalization_layers.BatchNormalization( @@ -1374,7 +1340,6 @@ class BNTest(test.TestCase): self.assertAlmostEqual(np.mean(normed_np_output), 0., places=1) self.assertAlmostEqual(np.std(normed_np_output), 1., places=1) - @test_util.run_deprecated_v1 def testGhostBN5DimsMultiAxis14(self): shape = [6, 3, 10, 10, 4] virtual_batch_size = 3 diff --git a/tensorflow/python/ops/gradients_test.py b/tensorflow/python/ops/gradients_test.py index a9058c4a341..abdcbc7a3ac 100644 --- a/tensorflow/python/ops/gradients_test.py +++ b/tensorflow/python/ops/gradients_test.py @@ -158,6 +158,7 @@ class GradientsTest(test_util.TensorFlowTestCase): grads = gradients.gradients(z, [x]) self.assertTrue(all(x is not None for x in grads)) + @test_util.run_v1_only("b/120545219") def testBoundaryContinue(self): # Test that we differentiate both 'x' and 'y' correctly when x is a # predecessor of y. @@ -169,6 +170,7 @@ class GradientsTest(test_util.TensorFlowTestCase): self.assertTrue(all(x is not None for x in grads)) self.assertEqual(6.0, grads[0].eval()) + @test_util.run_v1_only("b/120545219") def testAggregationMethodAccumulateN(self): with self.cached_session(): x = constant(1.0) @@ -182,6 +184,7 @@ class GradientsTest(test_util.TensorFlowTestCase): self.assertEqual(20.0, grads[0].eval()) self.assertEqual(10.0, grads[1].eval()) + @test_util.run_v1_only("b/120545219") def testAggregationMethodAddN(self): with self.cached_session(): x = constant(1.0) @@ -193,6 +196,7 @@ class GradientsTest(test_util.TensorFlowTestCase): self.assertEqual(20.0, grads[0].eval()) self.assertEqual(10.0, grads[1].eval()) + @test_util.run_v1_only("b/120545219") def testAggregationMethodTree(self): with self.cached_session(): x = constant(1.0) @@ -239,6 +243,7 @@ class GradientsTest(test_util.TensorFlowTestCase): [dx, dy], feed_dict={x: [1.0], dy.indices: [0], dy.values: [2.0]}) self.assertEqual(vdx, vdy) + @test_util.run_v1_only("b/120545219") def testNonDifferentiableSwitchInWhileLoop(self): with ops.Graph().as_default(): v = array_ops.placeholder(dtypes.float32, []) @@ -270,6 +275,7 @@ class GradientsTest(test_util.TensorFlowTestCase): gradient = gradients.gradients(graph.as_graph_element(var), var) self.assertIsNotNone(gradient) + @test_util.run_v1_only("b/120545219") def testVariableRefGradient(self): with ops.Graph().as_default(): init = constant_op.constant(100.0) @@ -277,6 +283,7 @@ class GradientsTest(test_util.TensorFlowTestCase): gradient = gradients.gradients(var._ref(), var) self.assertIsNotNone(gradient) + @test_util.run_v1_only("b/120545219") def testDependentYs(self): with self.cached_session(): x = constant_op.constant(3.0) @@ -292,6 +299,7 @@ class GradientsTest(test_util.TensorFlowTestCase): g = gradients.gradients([z, z2], x) self.assertAllClose(17502.0, g[0].eval()) + @test_util.run_v1_only("b/120545219") def testPartialDerivatives(self): with self.cached_session(): x = constant_op.constant(1.) @@ -302,6 +310,7 @@ class GradientsTest(test_util.TensorFlowTestCase): partialg = gradients.gradients(z, [x, y], stop_gradients=[x, y]) self.assertEqual([1.0, 1.0], [g.eval() for g in partialg]) + @test_util.run_v1_only("b/120545219") def testStopGradients(self): def _MakeGraph(rng, stop_gradients=()): def _FunctionOf(xs, k=3): @@ -606,6 +615,7 @@ class PreventGradientTest(test_util.TensorFlowTestCase): class HessianVectorProductTest(test_util.TensorFlowTestCase): + @test_util.run_v1_only("b/120545219") def testHessianVectorProduct(self): # Manually compute the Hessian explicitly for a low-dimensional problem # and check that HessianVectorProduct matches multiplication by the @@ -634,6 +644,7 @@ class HessianVectorProductTest(test_util.TensorFlowTestCase): class HessianTest(test_util.TensorFlowTestCase): + @test_util.run_v1_only("b/120545219") def testHessian1D(self): # Manually compute the Hessian explicitly for a low-dimensional problem # and check that `hessian` matches. Specifically, the Hessian of @@ -651,6 +662,7 @@ class HessianTest(test_util.TensorFlowTestCase): hess_actual = self.evaluate(hess) self.assertAllClose(hess_value, hess_actual) + @test_util.run_v1_only("b/120545219") def testHessian1D_multi(self): # Test the computation of the hessian with respect to multiple tensors m = 4 @@ -671,6 +683,7 @@ class HessianTest(test_util.TensorFlowTestCase): for hess_value, hess_actual in zip(hess_values, hessians_actual): self.assertAllClose(hess_value, hess_actual) + @test_util.run_v1_only("b/120545219") def testHessianInvalidDimension(self): for shape in [(10, 10), None]: with self.cached_session(use_gpu=True): @@ -679,6 +692,7 @@ class HessianTest(test_util.TensorFlowTestCase): with self.assertRaises(ValueError): gradients.hessians(x, x) + @test_util.run_v1_only("b/120545219") def testHessian2D_square_matrix(self): # Manually compute the Hessian explicitly for a low-dimensional problem # and check that `hessian` matches. Specifically, the Hessian of @@ -700,6 +714,7 @@ class HessianTest(test_util.TensorFlowTestCase): self.assertAllEqual((m, m, m, m), hess_actual.shape) self.assertAllClose(hess_value, hess_actual.reshape((m * m, m * m))) + @test_util.run_v1_only("b/120545219") def testHessian2D_non_square_matrix(self): m = 3 n = 4 @@ -722,6 +737,7 @@ class HessianTest(test_util.TensorFlowTestCase): class IndexedSlicesToTensorTest(test_util.TensorFlowTestCase): + @test_util.run_v1_only("b/120545219") def testIndexedSlicesToTensor(self): with self.cached_session(): np_val = np.random.rand(4, 4, 4, 4).astype(np.float32) @@ -731,6 +747,7 @@ class IndexedSlicesToTensorTest(test_util.TensorFlowTestCase): c_dense = math_ops.multiply(c_sparse, 1.0) self.assertAllClose(np_val, self.evaluate(c_dense)) + @test_util.run_v1_only("b/120545219") def testIndexedSlicesToTensorList(self): with self.cached_session(): numpy_list = [] @@ -747,6 +764,7 @@ class IndexedSlicesToTensorTest(test_util.TensorFlowTestCase): packed_sparse = array_ops.stack(sparse_list) self.assertAllClose(packed_dense.eval(), self.evaluate(packed_sparse)) + @test_util.run_v1_only("b/120545219") def testInt64Indices(self): with self.cached_session(): np_val = np.random.rand(4, 4, 4, 4).astype(np.float32) @@ -759,6 +777,7 @@ class IndexedSlicesToTensorTest(test_util.TensorFlowTestCase): c_dense = math_ops.multiply(c_sparse, 1.0) self.assertAllClose(np_val, self.evaluate(c_dense)) + @test_util.run_v1_only("b/120545219") def testWarnings(self): # TODO(gunan) Reenable after this issue is fixed: # https://github.com/google/protobuf/issues/2812 @@ -802,6 +821,7 @@ class IndexedSlicesToTensorTest(test_util.TensorFlowTestCase): class OnlyRealGradientsTest(test_util.TensorFlowTestCase): + @test_util.run_v1_only("b/120545219") def testRealOnly(self): x = constant_op.constant(7+3j, dtype=dtypes.complex64) y = math_ops.square(x) @@ -814,6 +834,7 @@ class OnlyRealGradientsTest(test_util.TensorFlowTestCase): class ResourceCondTest(test_util.TensorFlowTestCase): + @test_util.run_v1_only("b/120545219") def testBasic(self): gamma = resource_variable_ops.ResourceVariable( np.random.random((3,)), @@ -943,6 +964,7 @@ class CustomGradientTest(test_util.TensorFlowTestCase): self.assertEqual(6., math_ops.reduce_sum(dx).numpy()) self.assertEqual(8., math_ops.reduce_sum(dw).numpy()) + @test_util.run_v1_only("b/120545219") def testCustomGradientErrorsWithNonResourceVariables(self): def F(x, use_resource=False): @@ -993,6 +1015,7 @@ class CustomGradientTest(test_util.TensorFlowTestCase): # Smoke test to ensure numpy inputs are accepted F(x) + @test_util.run_v1_only("b/120545219") def testRVGradientsDynamicCond(self): with self.cached_session(): alpha = resource_variable_ops.ResourceVariable( diff --git a/tensorflow/python/ops/nn_test.py b/tensorflow/python/ops/nn_test.py index 414a5cdbbe5..82fab741830 100644 --- a/tensorflow/python/ops/nn_test.py +++ b/tensorflow/python/ops/nn_test.py @@ -450,6 +450,7 @@ class DropoutTest(test_lib.TestCase): with self.assertRaises(ValueError): nn_ops.dropout(t, array_ops.placeholder(dtypes.float32, shape=[2])) + @test_util.run_deprecated_v1 def testInvalidRate(self): x_dim = 40 y_dim = 30 diff --git a/tensorflow/python/ops/ragged/ragged_batch_gather_op_test.py b/tensorflow/python/ops/ragged/ragged_batch_gather_op_test.py index d9d840500cb..7fe185641f1 100644 --- a/tensorflow/python/ops/ragged/ragged_batch_gather_op_test.py +++ b/tensorflow/python/ops/ragged/ragged_batch_gather_op_test.py @@ -135,7 +135,7 @@ class RaggedBatchGatherOpTest(test_util.TensorFlowTestCase, expected=ragged.constant_value( [[[[b'c', b'a'], [b'd', b'd']], [[b'f', b'e']]]], ragged_rank=2)), ]) - @test_util.run_deprecated_v1 + @test_util.run_v1_only('b/120545219') def testRaggedBatchGather(self, descr, params, indices, expected): result = ragged.batch_gather(params, indices) self.assertEqual( @@ -188,7 +188,7 @@ class RaggedBatchGatherOpTest(test_util.TensorFlowTestCase, indices=[[[0]]], message='batch shape from indices does not match params shape'), ]) - @test_util.run_deprecated_v1 + @test_util.run_v1_only('b/120545219') def testRaggedBatchGatherStaticError(self, params, indices, diff --git a/tensorflow/python/ops/ragged/ragged_boolean_mask_op_test.py b/tensorflow/python/ops/ragged/ragged_boolean_mask_op_test.py index d939d9d6341..763b0164054 100644 --- a/tensorflow/python/ops/ragged/ragged_boolean_mask_op_test.py +++ b/tensorflow/python/ops/ragged/ragged_boolean_mask_op_test.py @@ -298,7 +298,7 @@ class RaggedBooleanMaskOpTest(test_util.TensorFlowTestCase, keepdims=True, expected=ragged.constant_value([[[1], [4, 6]], [[7, 9], []]])), ]) # pyformat: disable - @test_util.run_deprecated_v1 + @test_util.run_v1_only('b/120545219') def testBooleanMask(self, descr, data, mask, keepdims, expected): actual = ragged.boolean_mask(data, mask, keepdims=keepdims) self.assertEqual( diff --git a/tensorflow/python/ops/ragged/ragged_concat_op_test.py b/tensorflow/python/ops/ragged/ragged_concat_op_test.py index 3699f90f46b..ba7867418ac 100644 --- a/tensorflow/python/ops/ragged/ragged_concat_op_test.py +++ b/tensorflow/python/ops/ragged/ragged_concat_op_test.py @@ -221,7 +221,7 @@ class RaggedConcatOpTest(test_util.TensorFlowTestCase, parameterized.TestCase): axis=0, expected=[[b'a00', b'a01'], [], [b'a20', b'a21']]), ) # pyformat: disable - @test_util.run_deprecated_v1 + @test_util.run_v1_only('b/120545219') def testRaggedConcat(self, descr, rt_inputs, @@ -280,7 +280,7 @@ class RaggedConcatOpTest(test_util.TensorFlowTestCase, parameterized.TestCase): error=errors.InvalidArgumentError, message='Input tensors have incompatible shapes'), ]) - @test_util.run_deprecated_v1 + @test_util.run_v1_only('b/120545219') def testRuntimeError(self, rt_inputs, axis, error, message, ragged_ranks=None): rt_inputs = [ diff --git a/tensorflow/python/ops/ragged/ragged_dispatch_test.py b/tensorflow/python/ops/ragged/ragged_dispatch_test.py index 2bb10adce0e..2533c60c4ee 100644 --- a/tensorflow/python/ops/ragged/ragged_dispatch_test.py +++ b/tensorflow/python/ops/ragged/ragged_dispatch_test.py @@ -126,6 +126,7 @@ BINARY_INT_OPS = [ ] +@test_util.run_v1_only('b/120545219') class RaggedElementwiseOpsTest(test_util.TensorFlowTestCase, parameterized.TestCase): @@ -401,7 +402,6 @@ class RaggedElementwiseOpsTest(test_util.TensorFlowTestCase, result_flat_values = array_ops.reshape(result, [-1]) self.assertAllEqual(expected_flat_values, result_flat_values) - @test_util.run_deprecated_v1 def testElementwiseOpUnknownRankError(self): x = ragged.constant([[1, 2], [3]]) y = ragged.from_row_splits( diff --git a/tensorflow/python/ops/ragged/ragged_from_sparse_op_test.py b/tensorflow/python/ops/ragged/ragged_from_sparse_op_test.py index 3c0db9e8fb6..674dbab1126 100644 --- a/tensorflow/python/ops/ragged/ragged_from_sparse_op_test.py +++ b/tensorflow/python/ops/ragged/ragged_from_sparse_op_test.py @@ -29,7 +29,7 @@ from tensorflow.python.platform import googletest class RaggedTensorToSparseOpTest(test_util.TensorFlowTestCase): - @test_util.run_deprecated_v1 + @test_util.run_v1_only('b/120545219') def testDocStringExample(self): st = sparse_tensor.SparseTensor( indices=[[0, 0], [0, 1], [0, 2], [1, 0], [3, 0]], @@ -40,7 +40,7 @@ class RaggedTensorToSparseOpTest(test_util.TensorFlowTestCase): with self.test_session(): self.assertEqual(rt.eval().tolist(), [[1, 2, 3], [4], [], [5]]) - @test_util.run_deprecated_v1 + @test_util.run_v1_only('b/120545219') def testEmpty(self): st = sparse_tensor.SparseTensor( indices=array_ops.zeros([0, 2], dtype=dtypes.int64), @@ -67,7 +67,7 @@ class RaggedTensorToSparseOpTest(test_util.TensorFlowTestCase): self.assertRaisesRegexp(ValueError, r'rank\(st_input\) must be 2', ragged.from_sparse, st3) - @test_util.run_deprecated_v1 + @test_util.run_v1_only('b/120545219') def testGoodPartialSparseTensorRank(self): st1 = sparse_tensor.SparseTensor( indices=[[0, 0]], @@ -82,7 +82,7 @@ class RaggedTensorToSparseOpTest(test_util.TensorFlowTestCase): ragged.from_sparse(st1) ragged.from_sparse(st2) - @test_util.run_deprecated_v1 + @test_util.run_v1_only('b/120545219') def testNonRaggedSparseTensor(self): # "index_suffix" means the value of the innermost dimension of the index # (i.e., indices[i][-1]). diff --git a/tensorflow/python/ops/ragged/ragged_from_tensor_op_test.py b/tensorflow/python/ops/ragged/ragged_from_tensor_op_test.py index 1d8a00cc18d..09c17fad619 100644 --- a/tensorflow/python/ops/ragged/ragged_from_tensor_op_test.py +++ b/tensorflow/python/ops/ragged/ragged_from_tensor_op_test.py @@ -31,7 +31,7 @@ from tensorflow.python.platform import googletest class RaggedFromTensorOpTest(test_util.TensorFlowTestCase, parameterized.TestCase): - @test_util.run_deprecated_v1 + @test_util.run_v1_only('b/120545219') def testDocStringExamples(self): # The examples from ragged.from_tensor.__doc__. dt = constant_op.constant([[5, 7, 0], [0, 3, 0], [6, 0, 0]]) @@ -263,7 +263,7 @@ class RaggedFromTensorOpTest(test_util.TensorFlowTestCase, [[[5, 6], [7]], [[0, 8], []]]] }, ) # pyformat: disable - @test_util.run_deprecated_v1 + @test_util.run_v1_only('b/120545219') def testRaggedFromTensor(self, tensor, expected, @@ -398,7 +398,7 @@ class RaggedFromTensorOpTest(test_util.TensorFlowTestCase, 'expected': [[], []] }, ) - @test_util.run_deprecated_v1 + @test_util.run_v1_only('b/120545219') def testEmpty(self, dt_shape, expected, lengths=None, padding=None): dt = array_ops.zeros(dt_shape) rt = ragged.from_tensor(dt, lengths, padding) diff --git a/tensorflow/python/ops/ragged/ragged_gather_nd_op_test.py b/tensorflow/python/ops/ragged/ragged_gather_nd_op_test.py index 62c6819374a..b0a4fe9d313 100644 --- a/tensorflow/python/ops/ragged/ragged_gather_nd_op_test.py +++ b/tensorflow/python/ops/ragged/ragged_gather_nd_op_test.py @@ -28,6 +28,7 @@ from tensorflow.python.ops import ragged from tensorflow.python.platform import googletest +@test_util.run_v1_only('b/120545219') class RaggedGatherNdOpTest(test_util.TensorFlowTestCase, parameterized.TestCase): @@ -183,7 +184,6 @@ class RaggedGatherNdOpTest(test_util.TensorFlowTestCase, indices=[[0, 0, 1], [0, 0, 0], [0, 1, 0]], expected=[[b'c', b'd'], [b'a', b'b'], [b'e', b'f']]), ]) # pyformat: disable - @test_util.run_deprecated_v1 def testRaggedGatherNd(self, descr, params, indices, expected): result = ragged.gather_nd(params, indices) self.assertEqual( @@ -193,7 +193,6 @@ class RaggedGatherNdOpTest(test_util.TensorFlowTestCase, expected = expected.tolist() self.assertEqual(self.evaluate(result).tolist(), expected) - @test_util.run_deprecated_v1 def testRaggedGatherNdUnknownRankError(self): params = ragged.constant([['a', 'b'], ['c', 'd']]) indices1 = array_ops.placeholder(dtypes.int32, shape=None) @@ -221,7 +220,6 @@ class RaggedGatherNdOpTest(test_util.TensorFlowTestCase, indices=ragged.constant([[0]]), message='The innermost dimension of indices may not be ragged'), ]) - @test_util.run_deprecated_v1 def testRaggedGatherNdStaticError(self, params, indices, diff --git a/tensorflow/python/ops/ragged/ragged_gather_op_test.py b/tensorflow/python/ops/ragged/ragged_gather_op_test.py index 76c90cdfeeb..d371745b73c 100644 --- a/tensorflow/python/ops/ragged/ragged_gather_op_test.py +++ b/tensorflow/python/ops/ragged/ragged_gather_op_test.py @@ -30,7 +30,7 @@ from tensorflow.python.platform import googletest class RaggedTensorOpsTest(test_util.TensorFlowTestCase): - @test_util.run_deprecated_v1 + @test_util.run_v1_only('b/120545219') def testDocStringExamples(self): params = constant_op.constant(['a', 'b', 'c', 'd', 'e']) indices = constant_op.constant([3, 1, 2, 1, 0]) @@ -66,7 +66,7 @@ class RaggedTensorOpsTest(test_util.TensorFlowTestCase): ragged.gather(params, indices).eval().tolist(), [[b'f'], [b'a', b'b'], [b'f'], [b'c', b'd', b'e']]) - @test_util.run_deprecated_v1 + @test_util.run_v1_only('b/120545219') def testTensorParamsAndRaggedIndices(self): params = ['a', 'b', 'c', 'd', 'e'] indices = ragged.constant([[2, 1], [1, 2, 0], [3]]) @@ -75,7 +75,7 @@ class RaggedTensorOpsTest(test_util.TensorFlowTestCase): ragged.gather(params, indices).eval().tolist(), [[b'c', b'b'], [b'b', b'c', b'a'], [b'd']]) - @test_util.run_deprecated_v1 + @test_util.run_v1_only('b/120545219') def testRaggedParamsAndRaggedIndices(self): params = ragged.constant([['a', 'b'], ['c', 'd', 'e'], ['f'], [], ['g']]) indices = ragged.constant([[2, 1], [1, 2, 0], [3]]) @@ -108,7 +108,7 @@ class RaggedTensorOpsTest(test_util.TensorFlowTestCase): [[[b'g']], [[b'g']]]] # [p2, p2]] ) # pyformat: disable - @test_util.run_deprecated_v1 + @test_util.run_v1_only('b/120545219') def testTensorParamsAnd4DRaggedIndices(self): indices = ragged.constant( [[[[3, 4], [0, 6]], []], [[[2, 1], [1, 0]], [[2, 5]], [[2, 3]]], @@ -123,7 +123,7 @@ class RaggedTensorOpsTest(test_util.TensorFlowTestCase): [[[b'c', b'b'], [b'b', b'a']], [[b'c', b'f']], [[b'c', b'd']]], [[[b'b', b'a']]]]) # pyformat: disable - @test_util.run_deprecated_v1 + @test_util.run_v1_only('b/120545219') def testOutOfBoundsError(self): tensor_params = ['a', 'b', 'c'] tensor_indices = [0, 1, 2] diff --git a/tensorflow/python/ops/ragged/ragged_map_fn_op_test.py b/tensorflow/python/ops/ragged/ragged_map_fn_op_test.py index ecd78a91b2d..ab70d5a1230 100644 --- a/tensorflow/python/ops/ragged/ragged_map_fn_op_test.py +++ b/tensorflow/python/ops/ragged/ragged_map_fn_op_test.py @@ -30,6 +30,7 @@ from tensorflow.python.ops import string_ops from tensorflow.python.platform import googletest +@test_util.run_v1_only('b/120545219') class RaggedMapOpTest(test_util.TensorFlowTestCase, parameterized.TestCase): @parameterized.parameters([ # The following test sets map over a RaggedTensor and apply a @@ -141,7 +142,6 @@ class RaggedMapOpTest(test_util.TensorFlowTestCase, parameterized.TestCase): ), ]) - @test_util.run_deprecated_v1 def testRaggedMap( self, fn, @@ -166,7 +166,6 @@ class RaggedMapOpTest(test_util.TensorFlowTestCase, parameterized.TestCase): output_values = self.evaluate(output) self.assertAllEqual(expected_output, output_values.tolist()) - @test_util.run_deprecated_v1 def testRaggedMapOnStructure(self): batman = ragged.constant([[1, 2, 3], [4], [5, 6, 7]]) # [[10, 20, 30], [40], [50, 60, 70]] @@ -187,7 +186,6 @@ class RaggedMapOpTest(test_util.TensorFlowTestCase, parameterized.TestCase): self.assertAllEqual(output.eval().tolist(), [66, 44, 198]) # Test mapping over a dict of RTs can produce a dict of RTs. - @test_util.run_deprecated_v1 def testRaggedMapOnStructure_RaggedOutputs(self): batman = ragged.constant([[1, 2, 3], [4], [5, 6, 7]]) # [[10, 20, 30], [40], [50, 60, 70]] @@ -219,7 +217,6 @@ class RaggedMapOpTest(test_util.TensorFlowTestCase, parameterized.TestCase): self.assertAllEqual(output['robin'].eval().tolist(), [[11, 21, 31], [41], [51, 61, 71]]) - @test_util.run_deprecated_v1 def testZip(self): x = ragged.constant([[10, 20], [30, 40], [50, 60], [70], [80, 90, 100]], dtypes.int64) @@ -242,7 +239,6 @@ class RaggedMapOpTest(test_util.TensorFlowTestCase, parameterized.TestCase): result, [[[0, 10], [0, 20]], [[1, 30], [1, 40]], [[2, 50], [2, 60]], [[3, 70]], [[4, 80], [4, 90], [4, 100]]]) - @test_util.run_deprecated_v1 def testBatchGather(self): tokens = ragged.constant([['hello', '.', 'there'], ['merhaba'], ['bonjour', '.', 'ca va', '?']]) diff --git a/tensorflow/python/ops/ragged/ragged_map_inner_values_op_test.py b/tensorflow/python/ops/ragged/ragged_map_inner_values_op_test.py index b5802cb82d9..dc214f44370 100644 --- a/tensorflow/python/ops/ragged/ragged_map_inner_values_op_test.py +++ b/tensorflow/python/ops/ragged/ragged_map_inner_values_op_test.py @@ -43,7 +43,7 @@ class RaggedMapInnerValuesOpTest(test_util.TensorFlowTestCase, with self.test_session(): self.assertEqual(result.eval().tolist(), expected) - @test_util.run_deprecated_v1 + @test_util.run_v1_only('b/120545219') def testDocStringExamples(self): """Test the examples in apply_op_to_ragged_values.__doc__.""" rt = ragged.constant([[1, 2, 3], [], [4, 5], [6]]) @@ -63,7 +63,7 @@ class RaggedMapInnerValuesOpTest(test_util.TensorFlowTestCase, args=(tensor,), expected=[[0, 0, 0], [], [0, 0]]) - @test_util.run_deprecated_v1 + @test_util.run_v1_only('b/120545219') def testOpWithTwoRaggedTensorArgs(self): x = ragged.constant([[3, 1, 4], [], [1, 5]]) y = ragged.constant([[1, 2, 3], [], [4, 5]]) @@ -76,7 +76,7 @@ class RaggedMapInnerValuesOpTest(test_util.TensorFlowTestCase, self.assertRaggedMapInnerValuesReturns( op=math_ops.multiply, args=(5, y), expected=[[5, 10, 15], [], [20, 25]]) - @test_util.run_deprecated_v1 + @test_util.run_v1_only('b/120545219') def testOpWithThreeRaggedTensorArgs(self): condition = ragged.constant( [[True, True, False], [], [True, False]]) # pyformat: disable @@ -87,7 +87,7 @@ class RaggedMapInnerValuesOpTest(test_util.TensorFlowTestCase, args=(condition, x, y), expected=[[b'a', b'b', b'C'], [], [b'd', b'E']]) - @test_util.run_deprecated_v1 + @test_util.run_v1_only('b/120545219') def testOpWithRaggedTensorListArg(self): x = ragged.constant([[1, 2, 3], [], [4, 5]]) y = ragged.constant([[10, 20, 30], [], [40, 50]]) @@ -96,7 +96,7 @@ class RaggedMapInnerValuesOpTest(test_util.TensorFlowTestCase, args=([x, y, x],), expected=[[12, 24, 36], [], [48, 60]]) - @test_util.run_deprecated_v1 + @test_util.run_v1_only('b/120545219') def testOpWithKeywordArgs(self): x = ragged.constant([[3, 1, 4], [], [1, 5]]) y = ragged.constant([[1, 2, 3], [], [4, 5]]) @@ -105,7 +105,7 @@ class RaggedMapInnerValuesOpTest(test_util.TensorFlowTestCase, kwargs=dict(x=x, y=y), expected=[[3, 2, 12], [], [4, 25]]) - @test_util.run_deprecated_v1 + @test_util.run_v1_only('b/120545219') def testOpWithMixedPositionalAndKeywordArgs(self): x = ragged.constant([[3, 1, 4], [], [1, 5]]) y = ragged.constant([[1, 2, 3], [], [4, 5]]) @@ -128,7 +128,7 @@ class RaggedMapInnerValuesOpTest(test_util.TensorFlowTestCase, }, expected=[[8, 15, 13], [], [16, 25]]) - @test_util.run_deprecated_v1 + @test_util.run_v1_only('b/120545219') def testOpWithRaggedRankGreaterThanOne(self): # ragged_rank=0 x0 = [3, 1, 4, 1, 5, 9, 2, 6, 5] @@ -173,7 +173,7 @@ class RaggedMapInnerValuesOpTest(test_util.TensorFlowTestCase, [[[54, 14], [48, 45]]] # row 3 ]) # pyformat: disable - @test_util.run_deprecated_v1 + @test_util.run_v1_only('b/120545219') def testOpWithRaggedRankThree(self): x = ragged.constant([[[3, 1, 4]], [], [[], [1, 5]]]) y = ragged.constant([[[1, 2, 3]], [], [[], [4, 5]]]) @@ -203,7 +203,7 @@ class RaggedMapInnerValuesOpTest(test_util.TensorFlowTestCase, r'Inputs must have identical ragged splits.*', ragged.map_inner_values, math_ops.add, x, y) - @test_util.run_deprecated_v1 + @test_util.run_v1_only('b/120545219') def testRaggedTensorSplitsMismatchErrorAtRuntime(self): splits1 = array_ops.placeholder_with_default( constant_op.constant([0, 3, 3, 5], dtypes.int64), None) diff --git a/tensorflow/python/ops/ragged/ragged_operators_test.py b/tensorflow/python/ops/ragged/ragged_operators_test.py index 7fe8159d822..c1223db3072 100644 --- a/tensorflow/python/ops/ragged/ragged_operators_test.py +++ b/tensorflow/python/ops/ragged/ragged_operators_test.py @@ -23,11 +23,11 @@ from tensorflow.python.ops import ragged from tensorflow.python.platform import googletest +@test_util.run_v1_only('b/120545219') class RaggedElementwiseOpsTest(test_util.TensorFlowTestCase): # @TODO(edloper): Test right-handed versions of operators once we add # broadcasting support for elementwise ops. - @test_util.run_deprecated_v1 def testOrderingOperators(self): x = ragged.constant([[1, 5], [3]]) y = ragged.constant([[4, 5], [1]]) @@ -41,7 +41,6 @@ class RaggedElementwiseOpsTest(test_util.TensorFlowTestCase): if a != b: print('%30s %s' % (b, a)) - @test_util.run_deprecated_v1 def testArithmeticOperators(self): x = ragged.constant([[1.0, -2.0], [8.0]]) y = ragged.constant([[4.0, 4.0], [2.0]]) @@ -77,7 +76,6 @@ class RaggedElementwiseOpsTest(test_util.TensorFlowTestCase): self.assertEqual((2.0 % y).eval().tolist(), [[2.0, 2.0], [0.0]]) self.assertEqual((x % 2.0).eval().tolist(), [[1.0, 0.0], [0.0]]) - @test_util.run_deprecated_v1 def testLogicalOperators(self): a = ragged.constant([[True, True], [False]]) b = ragged.constant([[True, False], [False]]) diff --git a/tensorflow/python/ops/ragged/ragged_reduce_op_test.py b/tensorflow/python/ops/ragged/ragged_reduce_op_test.py index 9f51d59ba3c..2e4db2a423f 100644 --- a/tensorflow/python/ops/ragged/ragged_reduce_op_test.py +++ b/tensorflow/python/ops/ragged/ragged_reduce_op_test.py @@ -300,7 +300,7 @@ class RaggedReduceOpsTest(test_util.TensorFlowTestCase, parameterized.TestCase): axis=2, expected=[[mean(1, 2), mean(3, 4, 5)], [mean(6, 7), 8], [9]]), ) - @test_util.run_deprecated_v1 + @test_util.run_v1_only('b/120545219') def testReduce(self, ragged_reduce_op, rt_input, axis, expected): rt_input = ragged.constant(rt_input) reduced = ragged_reduce_op(rt_input, axis) diff --git a/tensorflow/python/ops/ragged/ragged_row_lengths_op_test.py b/tensorflow/python/ops/ragged/ragged_row_lengths_op_test.py index 4a705be4848..9f4aa1b1360 100644 --- a/tensorflow/python/ops/ragged/ragged_row_lengths_op_test.py +++ b/tensorflow/python/ops/ragged/ragged_row_lengths_op_test.py @@ -143,7 +143,7 @@ class RaggedRowLengthsOp(test_util.TensorFlowTestCase, parameterized.TestCase): expected=[[2, 3, 0], [4, 1]], expected_ragged_rank=1), ]) # pyformat: disable - @test_util.run_deprecated_v1 + @test_util.run_v1_only('b/120545219') def testRowLengths(self, rt_input, expected, diff --git a/tensorflow/python/ops/ragged/ragged_segment_op_test.py b/tensorflow/python/ops/ragged/ragged_segment_op_test.py index 9e4877ae3e6..52fe739342c 100644 --- a/tensorflow/python/ops/ragged/ragged_segment_op_test.py +++ b/tensorflow/python/ops/ragged/ragged_segment_op_test.py @@ -182,7 +182,7 @@ class RaggedSegmentOpsTest(test_util.TensorFlowTestCase, []] # pyformat: disable self.assertEqual(self.evaluate(segmented2).tolist(), expected2) - @test_util.run_deprecated_v1 + @test_util.run_v1_only('b/120545219') def testRaggedSegmentIds(self): rt = ragged.constant([ [[111, 112, 113, 114], [121],], # row 0 @@ -205,7 +205,7 @@ class RaggedSegmentOpsTest(test_util.TensorFlowTestCase, 'but segment_ids is ragged and data is not.', ragged.segment_sum, dt, segment_ids, 3) - @test_util.run_deprecated_v1 + @test_util.run_v1_only('b/120545219') def testShapeMismatchError2(self): rt = ragged.constant([ [[111, 112, 113, 114], [121]], # row 0 diff --git a/tensorflow/python/ops/ragged/ragged_stack_op_test.py b/tensorflow/python/ops/ragged/ragged_stack_op_test.py index 43434716942..ed07aca6d4c 100644 --- a/tensorflow/python/ops/ragged/ragged_stack_op_test.py +++ b/tensorflow/python/ops/ragged/ragged_stack_op_test.py @@ -265,7 +265,7 @@ class RaggedStackOpTest(test_util.TensorFlowTestCase, parameterized.TestCase): axis=0, expected=[[[b'a00', b'a01'], [], [b'a20', b'a21']]]), ) # pyformat: disable - @test_util.run_deprecated_v1 + @test_util.run_v1_only('b/120545219') def testRaggedStack(self, descr, rt_inputs, diff --git a/tensorflow/python/ops/ragged/ragged_tensor_shape_test.py b/tensorflow/python/ops/ragged/ragged_tensor_shape_test.py index 9c2dd260503..699dcc2bdb2 100644 --- a/tensorflow/python/ops/ragged/ragged_tensor_shape_test.py +++ b/tensorflow/python/ops/ragged/ragged_tensor_shape_test.py @@ -82,6 +82,7 @@ class RaggedTensorShapeTest(test_util.TensorFlowTestCase, value=ragged.constant_value([[[1, 2], [3]], [[4, 5]]]), expected_dim_sizes=[2, [2, 1], [2, 1, 2]]), ]) + @test_util.run_v1_only('b/120545219') def testFromTensor(self, value, expected_dim_sizes): shape = ragged.RaggedTensorDynamicShape.from_tensor(value) expected = ragged.RaggedTensorDynamicShape.from_dim_sizes( @@ -105,6 +106,7 @@ class RaggedTensorShapeTest(test_util.TensorFlowTestCase, rank=5, expected_dim_sizes=[1, 3, [3, 2, 4], 2, 3]), ]) + @test_util.run_v1_only('b/120545219') def testBroadcastToRank(self, dim_sizes, rank, expected_dim_sizes): shape = ragged.RaggedTensorDynamicShape.from_dim_sizes(dim_sizes) expected = ragged.RaggedTensorDynamicShape.from_dim_sizes( @@ -281,6 +283,7 @@ class RaggedTensorShapeTest(test_util.TensorFlowTestCase, original_dim_sizes=[2, (2, 1), 2, 1], broadcast_dim_sizes=[2, (2, 1), 2, (2, 1, 2, 1, 2, 1)]), ]) # pyformat: disable + @test_util.run_v1_only('b/120545219') def testBroadcastDimension(self, axis, row_length, original_dim_sizes, broadcast_dim_sizes): """Tests for the broadcast_dimension method. @@ -370,6 +373,7 @@ class RaggedTensorShapeTest(test_util.TensorFlowTestCase, y_dims=[1, 1, 2, (2, 1)], expected_dims=[2, (2, 1), 2, (2, 1, 2, 1, 2, 1)]), ]) + @test_util.run_v1_only('b/120545219') def testBroadcastDynamicShape(self, x_dims, y_dims, expected_dims): x_shape = ragged.RaggedTensorDynamicShape.from_dim_sizes(x_dims) y_shape = ragged.RaggedTensorDynamicShape.from_dim_sizes(y_dims) @@ -416,6 +420,7 @@ class RaggedTensorShapeTest(test_util.TensorFlowTestCase, dim_sizes=[3, [3, 0, 2]], expected=ragged.constant_value([[10, 10, 10], [], [10, 10]])), ]) + @test_util.run_v1_only('b/120545219') def testRaggedBroadcastTo(self, x, dim_sizes, expected): shape = ragged.RaggedTensorDynamicShape.from_dim_sizes(dim_sizes) result = ragged.broadcast_to(x, shape) @@ -470,6 +475,7 @@ class RaggedTensorShapeTest(test_util.TensorFlowTestCase, [[[[11, 21], [32]], [[13, 23], [34]]], [[[15, 25], [36]]]])), ]) + @test_util.run_v1_only('b/120545219') def testRaggedAddWithBroadcasting(self, x, y, expected, doc): expected_rrank = getattr(expected, 'ragged_rank', 0) x = ragged.convert_to_tensor_or_ragged_tensor(x, dtype=dtypes.int32) diff --git a/tensorflow/python/ops/ragged/ragged_tensor_test.py b/tensorflow/python/ops/ragged/ragged_tensor_test.py index 608fbd6e5b7..e86676f70a4 100644 --- a/tensorflow/python/ops/ragged/ragged_tensor_test.py +++ b/tensorflow/python/ops/ragged/ragged_tensor_test.py @@ -861,7 +861,7 @@ class RaggedTensorTest(test_util.TensorFlowTestCase, parameterized.TestCase): (SLICE_BUILDER[:, -2:], [row[-2:] for row in EXAMPLE_RAGGED_TENSOR_2D]), # TODO(edloper): Add tests for strided slices, once support is added. ) - @test_util.run_deprecated_v1 + @test_util.run_v1_only('b/120545219') def testRaggedTensorGetItemWithRaggedRank1(self, slice_spec, expected): """Test that rt.__getitem__(slice_spec) == expected.""" # Ragged tensor @@ -903,7 +903,7 @@ class RaggedTensorTest(test_util.TensorFlowTestCase, parameterized.TestCase): (SLICE_BUILDER[..., 0, 0, 0], IndexError, 'Too many indices for RaggedTensor'), ) - @test_util.run_deprecated_v1 + @test_util.run_v1_only('b/120545219') def testRaggedTensorGetItemErrorsWithRaggedRank1(self, slice_spec, expected, message): """Test that rt.__getitem__(slice_spec) == expected.""" @@ -982,7 +982,7 @@ class RaggedTensorTest(test_util.TensorFlowTestCase, parameterized.TestCase): # TODO(edloper): Add tests slicing inner ragged dimensions, one support # is added. ) - @test_util.run_deprecated_v1 + @test_util.run_v1_only('b/120545219') def testRaggedTensorGetItemWithRaggedRank2(self, slice_spec, expected): """Test that rt.__getitem__(slice_spec) == expected.""" rt = ragged.from_nested_row_splits( @@ -1069,7 +1069,7 @@ class RaggedTensorTest(test_util.TensorFlowTestCase, parameterized.TestCase): rt = ragged.from_row_splits(values, [0, 1]) self._TestGetItemException(rt, slice_spec, expected, message) - @test_util.run_deprecated_v1 + @test_util.run_v1_only('b/120545219') def testGetItemNewAxis(self): # rt: [[[['a', 'b'], ['c', 'd']], [], [['e', 'f']]], []] splits1 = [0, 3, 3] @@ -1155,7 +1155,7 @@ class RaggedTensorTest(test_util.TensorFlowTestCase, parameterized.TestCase): # RaggedTensor.with_values() and RaggedTensor.with_inner_values(). #============================================================================= - @test_util.run_deprecated_v1 + @test_util.run_v1_only('b/120545219') def testWithValues(self): rt1 = ragged.constant([[1, 2], [3, 4, 5], [6], [], [7]]) rt2 = ragged.constant([[[1, 2], [3, 4, 5]], [[6]], [], [[], [7]]]) @@ -1208,7 +1208,7 @@ class RaggedTensorTest(test_util.TensorFlowTestCase, parameterized.TestCase): self.assertEqual(result['rt1'].tolist(), [[1, 2, 3], [4]]) self.assertEqual(result['rt2'].tolist(), [[[], [1, 2]], [[3]]]) - @test_util.run_deprecated_v1 + @test_util.run_v1_only('b/120545219') def testSessionPartialRunFeed(self): # Placeholder inputs. a = ragged.from_row_splits( diff --git a/tensorflow/python/ops/ragged/ragged_to_sparse_op_test.py b/tensorflow/python/ops/ragged/ragged_to_sparse_op_test.py index 69b31ad0e97..9863e3b583c 100644 --- a/tensorflow/python/ops/ragged/ragged_to_sparse_op_test.py +++ b/tensorflow/python/ops/ragged/ragged_to_sparse_op_test.py @@ -140,7 +140,7 @@ class RaggedTensorToSparseOpTest(test_util.TensorFlowTestCase): self.assertEqual(st.values.shape.as_list(), [7]) self.assertEqual(st.dense_shape.shape.as_list(), [3]) - @test_util.run_deprecated_v1 + @test_util.run_v1_only('b/120545219') def testKernelErrors(self): # An empty vector, defined using a placeholder to ensure that we can't # determine that it's invalid at graph-construction time. @@ -179,7 +179,7 @@ class RaggedTensorToSparseOpTest(test_util.TensorFlowTestCase): self.assertRaisesRegexp(errors.InvalidArgumentError, empty_splits_error, ragged.to_sparse(bad_rt5).eval) - @test_util.run_deprecated_v1 + @test_util.run_v1_only('b/120545219') def testGradient(self): # rt1.shape == rt2.shape == [2, (D2), (D3), 2]. rt1 = ragged.constant([[[[1.0, 2.0], [3.0, 4.0]], [[5.0, 6.0]]]], diff --git a/tensorflow/python/ops/ragged/ragged_util_test.py b/tensorflow/python/ops/ragged/ragged_util_test.py index c24ea653531..69c605dbf98 100644 --- a/tensorflow/python/ops/ragged/ragged_util_test.py +++ b/tensorflow/python/ops/ragged/ragged_util_test.py @@ -87,6 +87,7 @@ class RaggedRepeatTest(test_util.TensorFlowTestCase, parameterized.TestCase): # Empty tensor dict(data=[], repeats=[], axis=0, expected=[]), ]) + @test_util.run_v1_only('b/120545219') def testRepeat(self, data, repeats, expected, axis=None): result = ragged_util.repeat(data, repeats, axis) with self.test_session(): @@ -135,6 +136,7 @@ class RaggedRepeatTest(test_util.TensorFlowTestCase, parameterized.TestCase): dict(data=TENSOR_4D, repeats=[1, 3, 0, 0, 2], axis=3), ] ]) + @test_util.run_v1_only('b/120545219') def testValuesMatchesNumpy(self, mode, data, repeats, axis): # Exception: we can't handle negative axis if data.ndims is unknown. if axis < 0 and mode == 'unknown_shape': diff --git a/tensorflow/python/ops/ragged/ragged_where_op_test.py b/tensorflow/python/ops/ragged/ragged_where_op_test.py index de83a549771..6d645eeface 100644 --- a/tensorflow/python/ops/ragged/ragged_where_op_test.py +++ b/tensorflow/python/ops/ragged/ragged_where_op_test.py @@ -165,7 +165,7 @@ class RaggedWhereOpTest(test_util.TensorFlowTestCase, parameterized.TestCase): y=ragged.constant_value([[[['a']]], [[['b']]]]), expected=ragged.constant_value([[[[], [b'A']]], [[[b'b']]]])), ]) # pyformat: disable - @test_util.run_deprecated_v1 + @test_util.run_v1_only('b/120545219') def testRaggedWhere(self, condition, expected, x=None, y=None): result = ragged.where(condition, x, y) self.assertEqual( diff --git a/tensorflow/python/profiler/internal/run_metadata_test.py b/tensorflow/python/profiler/internal/run_metadata_test.py index a8859f845b3..f96d721f46e 100644 --- a/tensorflow/python/profiler/internal/run_metadata_test.py +++ b/tensorflow/python/profiler/internal/run_metadata_test.py @@ -169,7 +169,7 @@ class RunMetadataTest(test.TestCase): ret = _extract_node(run_meta, 'MatMul:MatMul') self.assertEqual(len(ret), 0) - @test_util.run_deprecated_v1 + @test_util.run_v1_only('b/120545219') def testLoopCPU(self): ops.reset_default_graph() with ops.device('/cpu:0'): diff --git a/tensorflow/python/profiler/model_analyzer_test.py b/tensorflow/python/profiler/model_analyzer_test.py index 8648f0b5148..1c7c15be4fe 100644 --- a/tensorflow/python/profiler/model_analyzer_test.py +++ b/tensorflow/python/profiler/model_analyzer_test.py @@ -76,6 +76,7 @@ class PrintModelAnalysisTest(test.TestCase): ' ScalarW (1, 1/1 params)\n', lib.CheckAndRemoveDoc(f.read())) + @test_util.run_v1_only('b/120545219') def testSelectEverythingDetail(self): ops.reset_default_graph() dev = '/device:GPU:0' if test.is_gpu_available() else '/device:CPU:0' @@ -203,6 +204,7 @@ class PrintModelAnalysisTest(test.TestCase): lib.CheckAndRemoveDoc(f.read())[0:80]) # pylint: enable=line-too-long + @test_util.run_v1_only('b/120545219') def testComplexCodeView(self): ops.reset_default_graph() outfile = os.path.join(test.get_temp_dir(), 'dump') @@ -619,6 +621,7 @@ class PrintModelAnalysisTest(test.TestCase): else: self.assertEqual(len(gfile.ListDirectory(profile_dir)), 0) + @test_util.run_v1_only('b/120545219') def testAutoProfiling(self): ops.reset_default_graph() time_dir = os.path.join(test.get_temp_dir(), 'time') @@ -706,6 +709,7 @@ class PrintModelAnalysisTest(test.TestCase): exception_str) self.assertTrue(mat is None) + @test_util.run_v1_only('b/120545219') def testTrackPersistentBytes(self): ops.reset_default_graph() a = array_ops.constant(np.ones((100, 100))) diff --git a/tensorflow/python/profiler/pprof_profiler_test.py b/tensorflow/python/profiler/pprof_profiler_test.py index 120a0d0eaa6..3f5bd9e79be 100644 --- a/tensorflow/python/profiler/pprof_profiler_test.py +++ b/tensorflow/python/profiler/pprof_profiler_test.py @@ -136,7 +136,7 @@ comment: 9 profile.ParseFromString(profile_contents) self.assertEquals(expected_proto, str(profile)) - @test_util.run_deprecated_v1 + @test_util.run_v1_only('b/120545219') def testProfileWithWhileLoop(self): options = config_pb2.RunOptions() options.trace_level = config_pb2.RunOptions.FULL_TRACE diff --git a/tensorflow/python/saved_model/loader_test.py b/tensorflow/python/saved_model/loader_test.py index 3b7f0b250e7..3e27c0801cd 100644 --- a/tensorflow/python/saved_model/loader_test.py +++ b/tensorflow/python/saved_model/loader_test.py @@ -94,7 +94,7 @@ class SavedModelLoaderTest(test.TestCase, parameterized.TestCase): super(SavedModelLoaderTest, self).tearDown() shutil.rmtree(test.get_temp_dir(), ignore_errors=True) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def test_load_function(self, builder_cls): self.export_simple_graph(builder_cls) loader = loader_impl.SavedModelLoader(SIMPLE_ADD_SAVED_MODEL) @@ -110,7 +110,7 @@ class SavedModelLoaderTest(test.TestCase, parameterized.TestCase): self.assertEqual(5, sess.graph.get_tensor_by_name("x:0").eval()) self.assertEqual(7, sess.graph.get_tensor_by_name("y:0").eval()) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def test_load_graph(self, builder_cls): self.export_simple_graph(builder_cls) loader = loader_impl.SavedModelLoader(SIMPLE_ADD_SAVED_MODEL) @@ -130,7 +130,7 @@ class SavedModelLoaderTest(test.TestCase, parameterized.TestCase): with self.assertRaises(errors.FailedPreconditionError): self.evaluate(y) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def test_load_with_import_scope(self, builder_cls): self.export_graph_with_main_op(builder_cls) loader = loader_impl.SavedModelLoader(SAVED_MODEL_WITH_MAIN_OP) @@ -179,7 +179,7 @@ class SavedModelLoaderTest(test.TestCase, parameterized.TestCase): loader.restore_variables(sess, tf_saver.Saver()) self.assertEqual(55, self.evaluate(z)) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def test_run_init_op(self, builder_cls): self.export_graph_with_main_op(builder_cls) loader = loader_impl.SavedModelLoader(SAVED_MODEL_WITH_MAIN_OP) @@ -212,7 +212,7 @@ class SavedModelLoaderTest(test.TestCase, parameterized.TestCase): with self.assertRaises(RuntimeError): loader.get_meta_graph_def_from_tags(["not_a_graph"]) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def test_load_saved_model_with_no_variables(self, builder_cls): """Test that SavedModel runs saver when there appear to be no variables. diff --git a/tensorflow/python/saved_model/save_test.py b/tensorflow/python/saved_model/save_test.py index 668a374415a..97218a98eae 100644 --- a/tensorflow/python/saved_model/save_test.py +++ b/tensorflow/python/saved_model/save_test.py @@ -286,7 +286,7 @@ class SaveTest(test.TestCase): {"out": model(array_ops.ones([1, 4]))}, _import_and_infer(save_dir, {"x": [[1., 1., 1., 1.]]})) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def test_export_functional_keras_model_after_fit(self): x = input_layer.Input((1,)) y = core.Dense(1, name="y")(x) diff --git a/tensorflow/python/saved_model/saved_model_test.py b/tensorflow/python/saved_model/saved_model_test.py index d4c8d720117..8d94c7c989d 100644 --- a/tensorflow/python/saved_model/saved_model_test.py +++ b/tensorflow/python/saved_model/saved_model_test.py @@ -328,7 +328,7 @@ class SavedModelTest(SavedModelTestBase): self.assertRaises(RuntimeError, loader.load, sess, ["foo", "baz"], export_dir) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testVariables(self): export_dir = self._get_export_dir("test_variables") builder = saved_model_builder._SavedModelBuilder(export_dir) @@ -474,7 +474,7 @@ class SavedModelTest(SavedModelTestBase): self.assertEqual( 42, ops.get_collection(ops.GraphKeys.GLOBAL_VARIABLES)[0].eval()) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testCollections(self): export_dir = self._get_export_dir("test_collections") builder = saved_model_builder._SavedModelBuilder(export_dir) @@ -819,6 +819,7 @@ class SavedModelTest(SavedModelTestBase): self._validate_assets(export_dir, foo_graph.asset_file_def, "hello42.txt", "foo bar baz 0", "asset_file_tensor_0:0") + @test_util.run_v1_only("b/120545219") def testCustomInitOp(self): export_dir = self._get_export_dir("test_main_op") builder = saved_model_builder._SavedModelBuilder(export_dir) @@ -854,7 +855,7 @@ class SavedModelTest(SavedModelTestBase): # the main_op, following a restore. self.assertEqual(3, ops.get_collection("v")[2].eval()) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testTrainOp(self): export_dir = self._get_export_dir("test_train_op") builder = saved_model_builder._SavedModelBuilder(export_dir) @@ -882,7 +883,7 @@ class SavedModelTest(SavedModelTestBase): self.assertIsInstance( loader_impl.get_train_op(meta_graph_def), ops.Tensor) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testTrainOpGroup(self): export_dir = self._get_export_dir("test_train_op_group") builder = saved_model_builder._SavedModelBuilder(export_dir) @@ -910,7 +911,7 @@ class SavedModelTest(SavedModelTestBase): self.assertIsInstance( loader_impl.get_train_op(meta_graph_def), ops.Operation) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testTrainOpAfterVariables(self): export_dir = self._get_export_dir("test_train_op_after_variables") builder = saved_model_builder._SavedModelBuilder(export_dir) @@ -1029,7 +1030,7 @@ class SavedModelTest(SavedModelTestBase): self._validate_assets(export_dir, bar_graph.asset_file_def, "foo.txt", "content_foo", "asset_file_tensor:0") - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testOp(self): export_dir = self._get_export_dir("test_op") builder = saved_model_builder._SavedModelBuilder(export_dir) @@ -1492,7 +1493,7 @@ class SavedModelV1Test(SavedModelTestBase): self.assertIn("T", node_def.attr) self.assertIn("Tout", node_def.attr) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testLegacyInitOp(self): export_dir = self._get_export_dir("test_legacy_init_op") builder = saved_model_builder.SavedModelBuilder(export_dir) diff --git a/tensorflow/python/saved_model/signature_def_utils_test.py b/tensorflow/python/saved_model/signature_def_utils_test.py index 53c452359f1..d1347eb0178 100644 --- a/tensorflow/python/saved_model/signature_def_utils_test.py +++ b/tensorflow/python/saved_model/signature_def_utils_test.py @@ -423,6 +423,7 @@ class SignatureDefUtilsTest(test.TestCase): {}, signature_constants.PREDICT_METHOD_NAME) + @test_util.run_v1_only("b/120545219") def testOpSignatureDef(self): key = "adding_1_and_2_key" add_op = math_ops.add(1, 2, name="adding_1_and_2") @@ -430,6 +431,7 @@ class SignatureDefUtilsTest(test.TestCase): self.assertIn(key, signature_def.outputs) self.assertEqual(add_op.name, signature_def.outputs[key].name) + @test_util.run_v1_only("b/120545219") def testLoadOpFromSignatureDef(self): key = "adding_1_and_2_key" add_op = math_ops.add(1, 2, name="adding_1_and_2") diff --git a/tensorflow/python/saved_model/utils_test.py b/tensorflow/python/saved_model/utils_test.py index 0888dcb411e..2afe8abfd64 100644 --- a/tensorflow/python/saved_model/utils_test.py +++ b/tensorflow/python/saved_model/utils_test.py @@ -24,6 +24,7 @@ from tensorflow.python.framework import constant_op from tensorflow.python.framework import dtypes from tensorflow.python.framework import ops from tensorflow.python.framework import sparse_tensor +from tensorflow.python.framework import test_util from tensorflow.python.ops import array_ops from tensorflow.python.ops import control_flow_ops from tensorflow.python.platform import test @@ -32,6 +33,7 @@ from tensorflow.python.saved_model import utils class UtilsTest(test.TestCase): + @test_util.run_v1_only("b/120545219") def testBuildTensorInfoOp(self): x = constant_op.constant(1, name="x") y = constant_op.constant(2, name="y") @@ -41,6 +43,7 @@ class UtilsTest(test.TestCase): self.assertEqual(types_pb2.DT_INVALID, z_op_info.dtype) self.assertEqual(0, len(z_op_info.tensor_shape.dim)) + @test_util.run_v1_only("b/120545219") def testBuildTensorInfoDefunOp(self): @function.defun def my_init_fn(x, y): @@ -54,6 +57,7 @@ class UtilsTest(test.TestCase): self.assertEqual(types_pb2.DT_INVALID, init_op_info.dtype) self.assertEqual(0, len(init_op_info.tensor_shape.dim)) + @test_util.run_v1_only("b/120545219") def testBuildTensorInfoDense(self): x = array_ops.placeholder(dtypes.float32, 1, name="x") x_tensor_info = utils.build_tensor_info(x) @@ -62,6 +66,7 @@ class UtilsTest(test.TestCase): self.assertEqual(1, len(x_tensor_info.tensor_shape.dim)) self.assertEqual(1, x_tensor_info.tensor_shape.dim[0].size) + @test_util.run_v1_only("b/120545219") def testBuildTensorInfoSparse(self): x = array_ops.sparse_placeholder(dtypes.float32, [42, 69], name="x") x_tensor_info = utils.build_tensor_info(x) @@ -76,6 +81,7 @@ class UtilsTest(test.TestCase): self.assertEqual(42, x_tensor_info.tensor_shape.dim[0].size) self.assertEqual(69, x_tensor_info.tensor_shape.dim[1].size) + @test_util.run_v1_only("b/120545219") def testGetTensorFromInfoDense(self): expected = array_ops.placeholder(dtypes.float32, 1, name="x") tensor_info = utils.build_tensor_info(expected) @@ -83,6 +89,7 @@ class UtilsTest(test.TestCase): self.assertIsInstance(actual, ops.Tensor) self.assertEqual(expected.name, actual.name) + @test_util.run_v1_only("b/120545219") def testGetTensorFromInfoSparse(self): expected = array_ops.sparse_placeholder(dtypes.float32, name="x") tensor_info = utils.build_tensor_info(expected) @@ -122,6 +129,7 @@ class UtilsTest(test.TestCase): import_scope="foo") self.assertEqual(expected.name, actual.name) + @test_util.run_v1_only("b/120545219") def testGetTensorFromInfoRaisesErrors(self): expected = array_ops.placeholder(dtypes.float32, 1, name="x") tensor_info = utils.build_tensor_info(expected) diff --git a/tensorflow/python/tools/freeze_graph_test.py b/tensorflow/python/tools/freeze_graph_test.py index efdf7dd2cf1..de2672db3c4 100644 --- a/tensorflow/python/tools/freeze_graph_test.py +++ b/tensorflow/python/tools/freeze_graph_test.py @@ -161,11 +161,11 @@ class FreezeGraphTest(test_util.TensorFlowTestCase): },) builder.save(as_text=True) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testFreezeGraphV1(self): self._testFreezeGraph(saver_pb2.SaverDef.V1) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testFreezeGraphV2(self): self._testFreezeGraph(saver_pb2.SaverDef.V2) diff --git a/tensorflow/python/training/adagrad_test.py b/tensorflow/python/training/adagrad_test.py index da26fcdb7f6..1e2d29b3373 100644 --- a/tensorflow/python/training/adagrad_test.py +++ b/tensorflow/python/training/adagrad_test.py @@ -306,7 +306,7 @@ class AdagradOptimizerTest(test.TestCase): np.array([2.715679168701172, 3.715679168701172]), self.evaluate(var1)) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testDynamicShapeVariable_Ok(self): with self.cached_session(): v = variable_scope.get_variable("v", initializer=constant_op.constant(1.), @@ -315,7 +315,7 @@ class AdagradOptimizerTest(test.TestCase): # Creating optimizer should cause no exception. adagrad.AdagradOptimizer(3.0, initial_accumulator_value=0.1) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testDynamicShapeVariableWithCallableInit(self): var0 = variable_scope.get_variable("var0", initializer=constant_op.constant(1.), diff --git a/tensorflow/python/training/basic_session_run_hooks_test.py b/tensorflow/python/training/basic_session_run_hooks_test.py index 08942c5bb6e..1af27626ba7 100644 --- a/tensorflow/python/training/basic_session_run_hooks_test.py +++ b/tensorflow/python/training/basic_session_run_hooks_test.py @@ -1122,6 +1122,7 @@ class StepCounterHookTest(test.TestCase): self.assertGreater(summary_value.simple_value, 0) +@test_util.run_v1_only('b/120545219') class SummarySaverHookTest(test.TestCase): def setUp(self): @@ -1148,13 +1149,11 @@ class SummarySaverHookTest(test.TestCase): basic_session_run_hooks.SummarySaverHook( scaffold=monitored_session.Scaffold(), summary_op=self.summary_op) - @test_util.run_deprecated_v1 def test_raise_in_both_secs_and_steps(self): with self.assertRaises(ValueError): basic_session_run_hooks.SummarySaverHook( save_secs=10, save_steps=20, summary_writer=self.summary_writer) - @test_util.run_deprecated_v1 def test_raise_in_none_secs_and_steps(self): with self.assertRaises(ValueError): basic_session_run_hooks.SummarySaverHook( @@ -1405,6 +1404,7 @@ class FinalOpsHookTest(test.TestCase): hook.final_ops_values.tolist()) +@test_util.run_v1_only('b/120545219') class ResourceSummarySaverHookTest(test.TestCase): def setUp(self): diff --git a/tensorflow/python/training/checkpoint_ops_test.py b/tensorflow/python/training/checkpoint_ops_test.py index 21ad3df1c8f..c4815471392 100644 --- a/tensorflow/python/training/checkpoint_ops_test.py +++ b/tensorflow/python/training/checkpoint_ops_test.py @@ -23,6 +23,7 @@ import numpy as np from tensorflow.python.framework import constant_op from tensorflow.python.framework import dtypes from tensorflow.python.framework import ops +from tensorflow.python.framework import test_util from tensorflow.python.ops import array_ops from tensorflow.python.ops import init_ops from tensorflow.python.ops import partitioned_variables @@ -33,6 +34,7 @@ from tensorflow.python.training import checkpoint_ops from tensorflow.python.training import saver as saver_lib +@test_util.run_v1_only('b/120545219') class LoadAndRemapWrappersTest(test.TestCase): """Tests for the functionality of the Python wrappers.""" diff --git a/tensorflow/python/training/checkpointable/data_structures_test.py b/tensorflow/python/training/checkpointable/data_structures_test.py index 9cefd942ac9..bcec6e01001 100644 --- a/tensorflow/python/training/checkpointable/data_structures_test.py +++ b/tensorflow/python/training/checkpointable/data_structures_test.py @@ -73,6 +73,7 @@ class HasList(training.Model): class ListTests(test.TestCase): @test_util.run_in_graph_and_eager_modes + @test_util.run_v1_only("b/120545219") def testTracking(self): model = HasList() output = model(array_ops.ones([32, 2])) @@ -105,6 +106,7 @@ class ListTests(test.TestCase): self.assertIn(v, model.trainable_variables) self.assertNotIn(v, model.non_trainable_variables) + @test_util.run_v1_only("b/120545219") def testUpdatesForwarded(self): with context.graph_mode(): model = HasList() @@ -121,6 +123,7 @@ class ListTests(test.TestCase): self.assertEqual(0, len(model.updates)) @test_util.run_in_graph_and_eager_modes + @test_util.run_v1_only("b/120545219") def testLossesForwarded(self): model = HasList() model_input = array_ops.ones([32, 2]) @@ -295,6 +298,7 @@ class HasMapping(training.Model): class MappingTests(test.TestCase): @test_util.run_in_graph_and_eager_modes + @test_util.run_v1_only("b/120545219") def testTracking(self): model = HasMapping() output = model(array_ops.ones([32, 2])) diff --git a/tensorflow/python/training/checkpointable/util_test.py b/tensorflow/python/training/checkpointable/util_test.py index 78047eda90d..3bdab4cb0bf 100644 --- a/tensorflow/python/training/checkpointable/util_test.py +++ b/tensorflow/python/training/checkpointable/util_test.py @@ -616,6 +616,7 @@ class CheckpointingTests(test.TestCase): # pylint: disable=cell-var-from-loop @test_util.run_in_graph_and_eager_modes + @test_util.run_v1_only("b/120545219") def testWithDefun(self): num_training_steps = 2 checkpoint_directory = self.get_temp_dir() diff --git a/tensorflow/python/training/input_test.py b/tensorflow/python/training/input_test.py index a3d268a0174..d89f5f3bbd8 100644 --- a/tensorflow/python/training/input_test.py +++ b/tensorflow/python/training/input_test.py @@ -872,19 +872,19 @@ class BatchTest(test_lib.TestCase): for thread in threads: thread.join() - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testSingleThreadKeepInput(self): self._testKeepInputHelper(1, False) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testSingleThreadKeepInputEnqueueMany(self): self._testKeepInputHelper(1, True) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testMultipleThreadKeepInput(self): self._testKeepInputHelper(5, False) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testMultipleThreadKeepInputEnqueueMany(self): self._testKeepInputHelper(5, True) @@ -1482,19 +1482,19 @@ class BatchJoinTest(test_lib.TestCase): for thread in threads: thread.join() - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testSingleThreadKeepInput(self): self._testKeepInputHelper(1, False) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testSingleThreadKeepInputEnqueueMany(self): self._testKeepInputHelper(1, True) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testMultipleThreadKeepInput(self): self._testKeepInputHelper(5, False) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testMultipleThreadKeepInputEnqueueMany(self): self._testKeepInputHelper(5, True) @@ -1905,19 +1905,19 @@ class ShuffleBatchTest(test_lib.TestCase): for thread in threads: thread.join() - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testSingleThreadKeepInput(self): self._testKeepInputHelper(1, False) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testSingleThreadKeepInputEnqueueMany(self): self._testKeepInputHelper(1, True) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testMultipleThreadKeepInput(self): self._testKeepInputHelper(5, False) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testMultipleThreadKeepInputEnqueueMany(self): self._testKeepInputHelper(5, True) @@ -2309,19 +2309,19 @@ class ShuffleBatchJoinTest(test_lib.TestCase): for thread in threads: thread.join() - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testSingleThreadKeepInput(self): self._testKeepInputHelper(1, False) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testSingleThreadKeepInputEnqueueMany(self): self._testKeepInputHelper(1, True) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testMultipleThreadKeepInput(self): self._testKeepInputHelper(5, False) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testMultipleThreadKeepInputEnqueueMany(self): self._testKeepInputHelper(5, True) diff --git a/tensorflow/python/training/learning_rate_decay_test.py b/tensorflow/python/training/learning_rate_decay_test.py index 9de5bc8168f..1029d4cea8f 100644 --- a/tensorflow/python/training/learning_rate_decay_test.py +++ b/tensorflow/python/training/learning_rate_decay_test.py @@ -101,7 +101,7 @@ class LRDecayTest(test_util.TensorFlowTestCase): self.assertAllClose(self.evaluate(decayed_lr), 0.001, 1e-6) @test_util.run_in_graph_and_eager_modes - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testPiecewiseConstantEdgeCases(self): x_int = resource_variable_ops.ResourceVariable( 0, dtype=variables.dtypes.int32) diff --git a/tensorflow/python/training/localhost_cluster_performance_test.py b/tensorflow/python/training/localhost_cluster_performance_test.py index 7c097b943d0..c4cbc8a55dc 100644 --- a/tensorflow/python/training/localhost_cluster_performance_test.py +++ b/tensorflow/python/training/localhost_cluster_performance_test.py @@ -25,6 +25,7 @@ import numpy as np from tensorflow.python.client import session as session_lib from tensorflow.python.framework import dtypes from tensorflow.python.framework import ops +from tensorflow.python.framework import test_util from tensorflow.python.ops import partitioned_variables from tensorflow.python.ops import variable_scope from tensorflow.python.ops import variables @@ -34,6 +35,7 @@ from tensorflow.python.training import device_setter class CreateLocalClusterTest(test.TestCase): + @test_util.run_v1_only("b/120545219") def testCreateLocalCluster(self): workers, _ = test.create_local_cluster(num_workers=2, num_ps=2) worker_sessions = [session_lib.Session(w.target) for w in workers] diff --git a/tensorflow/python/training/monitored_session_test.py b/tensorflow/python/training/monitored_session_test.py index 9dbcfa52b7c..99ee9ea7e2e 100644 --- a/tensorflow/python/training/monitored_session_test.py +++ b/tensorflow/python/training/monitored_session_test.py @@ -541,6 +541,7 @@ class WrappedSessionTest(test.TestCase): self.assertFalse(wrapped_sess1.should_stop()) self.assertTrue(wrapped_sess1.should_stop()) + @test_util.run_deprecated_v1 def test_close_twice(self): with self.cached_session() as sess: wrapped_sess = monitored_session._WrappedSession(sess) diff --git a/tensorflow/python/training/moving_averages_test.py b/tensorflow/python/training/moving_averages_test.py index b15f7377f07..03bcde9c849 100644 --- a/tensorflow/python/training/moving_averages_test.py +++ b/tensorflow/python/training/moving_averages_test.py @@ -219,38 +219,38 @@ class ExponentialMovingAverageTest(test.TestCase): (10.0 + 30.0) * (1 - dk)) / _Scale(dk, 2), dim) self.assertAllClose(expected, self.evaluate(avg2)) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testAverageVariablesNoNumUpdates_Scalar(self): with self.cached_session(): ema = moving_averages.ExponentialMovingAverage(0.25) self._CheckDecay(ema, actual_decay=0.25, dim=1) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testAverageVariablesNoNumUpdates_Scalar_Debias(self): with self.cached_session(): ema = moving_averages.ExponentialMovingAverage(0.25, zero_debias=True) self._CheckDecay(ema, actual_decay=0.25, dim=1) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testAverageVariablesNoNumUpdates_Vector(self): with self.cached_session(): ema = moving_averages.ExponentialMovingAverage(0.25) self._CheckDecay(ema, actual_decay=0.25, dim=5) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testAverageVariablesNoNumUpdates_Vector_Debias(self): with self.cached_session(): ema = moving_averages.ExponentialMovingAverage(0.25, zero_debias=True) self._CheckDecay(ema, actual_decay=0.25, dim=5) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testAverageVariablesNumUpdates_Scalar(self): with self.cached_session(): # With num_updates 1, the decay applied is 0.1818 ema = moving_averages.ExponentialMovingAverage(0.25, num_updates=1) self._CheckDecay(ema, actual_decay=0.181818, dim=1) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testAverageVariablesNumUpdates_Scalar_Debias(self): with self.cached_session(): # With num_updates 1, the decay applied is 0.1818 @@ -258,14 +258,14 @@ class ExponentialMovingAverageTest(test.TestCase): 0.25, num_updates=1, zero_debias=True) self._CheckDecay(ema, actual_decay=0.181818, dim=1) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testAverageVariablesNumUpdates_Vector(self): with self.cached_session(): # With num_updates 1, the decay applied is 0.1818 ema = moving_averages.ExponentialMovingAverage(0.25, num_updates=1) self._CheckDecay(ema, actual_decay=0.181818, dim=5) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testAverageVariablesNumUpdates_Vector_Debias(self): with self.cached_session(): # With num_updates 1, the decay applied is 0.1818 @@ -273,7 +273,7 @@ class ExponentialMovingAverageTest(test.TestCase): 0.25, num_updates=1, zero_debias=True) self._CheckDecay(ema, actual_decay=0.181818, dim=5) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testAverageVariablesWithControlDeps(self): with self.cached_session() as sess: v0 = variables.Variable(0, name="v0") @@ -299,7 +299,7 @@ class ExponentialMovingAverageTest(test.TestCase): self.assertEqual([17.5], self.evaluate(v1_avg)) @test_util.run_in_graph_and_eager_modes - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testBasicEager(self): v0 = variables.Variable(1.0) v1 = variables.Variable(2.0) @@ -355,11 +355,11 @@ class ExponentialMovingAverageTest(test.TestCase): self.assertEqual(ema.average(v1).op.name, ema.average_name(v1)) self.assertEqual(ema.average(tensor2).op.name, ema.average_name(tensor2)) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testAverageVariablesNames(self): self.averageVariablesNamesHelper(zero_debias=True) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testAverageVariablesNamesNoDebias(self): self.averageVariablesNamesHelper(zero_debias=False) @@ -405,15 +405,15 @@ class ExponentialMovingAverageTest(test.TestCase): self.assertEqual( ema.average(tensor2).op.name, ema.average_name(tensor2)) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testAverageVariablesNamesRespectScope(self): self.averageVariablesNamesRespectScopeHelper(zero_debias=True) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testAverageVariablesNamesRespectScopeNoDebias(self): self.averageVariablesNamesRespectScopeHelper(zero_debias=False) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testSubsetAverageVariablesNames(self): with self.cached_session(): v0 = variables.Variable(10.0, name="v0") @@ -442,7 +442,7 @@ class ExponentialMovingAverageTest(test.TestCase): self.assertEqual(ema.average(v1).op.name, ema.average_name(v1)) self.assertEqual(ema.average(tensor2).op.name, ema.average_name(tensor2)) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testAverageVariablesDeviceAssignment(self): with ops.device("/job:dev_v0"): v0 = variables.Variable(10.0, name="v0") diff --git a/tensorflow/python/training/quantize_training_test.py b/tensorflow/python/training/quantize_training_test.py index 62e783f2000..2352af7e99b 100644 --- a/tensorflow/python/training/quantize_training_test.py +++ b/tensorflow/python/training/quantize_training_test.py @@ -53,7 +53,7 @@ class PywrapQuantizeTrainingTest(test.TestCase): # Test that save/restoring works for EMA variables generated in the # quantized training rewrite. - @test_util.run_deprecated_v1 + @test_util.run_v1_only('b/120545219') def testQuantizedSaveRestore(self): save_path = os.path.join(self.get_temp_dir(), 'quantized_save_restore') diff --git a/tensorflow/python/training/queue_runner_test.py b/tensorflow/python/training/queue_runner_test.py index 4113cecf55d..2f6e924f98e 100644 --- a/tensorflow/python/training/queue_runner_test.py +++ b/tensorflow/python/training/queue_runner_test.py @@ -41,7 +41,7 @@ _MockOp = collections.namedtuple("MockOp", ["name"]) class QueueRunnerTest(test.TestCase): - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testBasic(self): with self.cached_session() as sess: # CountUpTo will raise OUT_OF_RANGE when it reaches the count. @@ -62,7 +62,7 @@ class QueueRunnerTest(test.TestCase): # The variable should be 3. self.assertEqual(3, self.evaluate(var)) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testTwoOps(self): with self.cached_session() as sess: # CountUpTo will raise OUT_OF_RANGE when it reaches the count. @@ -132,7 +132,7 @@ class QueueRunnerTest(test.TestCase): with self.assertRaisesRegexp(errors_impl.OutOfRangeError, "is closed"): self.evaluate(dequeue1) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testRespectCoordShouldStop(self): with self.cached_session() as sess: # CountUpTo will raise OUT_OF_RANGE when it reaches the count. @@ -221,7 +221,7 @@ class QueueRunnerTest(test.TestCase): new_threads = qr.create_threads(sess, coord=coord) self.assertEqual([], new_threads) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testThreads(self): with self.cached_session() as sess: # CountUpTo will raise OUT_OF_RANGE when it reaches the count. diff --git a/tensorflow/python/training/saver_test.py b/tensorflow/python/training/saver_test.py index 5d621ba4ffa..95c21cb815f 100644 --- a/tensorflow/python/training/saver_test.py +++ b/tensorflow/python/training/saver_test.py @@ -390,7 +390,7 @@ class SaverTest(test.TestCase): ValueError, "The passed save_path is not a valid checkpoint:"): save.restore(sess, "invalid path") - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testInt64(self): save_path = os.path.join(self.get_temp_dir(), "int64") @@ -466,7 +466,7 @@ class SaverTest(test.TestCase): # Verify non-duplicate names work. saver_module.Saver({"v0": v0, "v2": v2.saveable}) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testBasicsWithListOfVariables(self): save_path = os.path.join(self.get_temp_dir(), "basics_with_list") @@ -667,7 +667,7 @@ class SaverTest(test.TestCase): self.assertAllClose(1.0, one.eval()) self.assertAllClose([2.0, 2.0, 2.0], twos.eval()) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testReshape(self): save_path = os.path.join(self.get_temp_dir(), "variables_reshape") with session.Session("", graph=ops_lib.Graph()) as sess: @@ -726,7 +726,7 @@ class SaverTest(test.TestCase): def testSaveWithGlobalStepWithPadding(self): self.testSaveWithGlobalStep(pad_step_number=True) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testSaveToNonexistingPath(self): file_io.write_string_to_file( os.path.join(self.get_temp_dir(), "actually_a_file"), "") @@ -1607,7 +1607,7 @@ class SaveRestoreWithVariableNameMap(test.TestCase): self.assertEqual(20.0, self.evaluate(v1)) @test_util.run_in_graph_and_eager_modes - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testNonReshapeResourceVariable(self): self._testNonReshape(resource_variable_ops.ResourceVariable) @@ -1622,7 +1622,7 @@ class MetaGraphTest(test.TestCase): gfile.MakeDirs(test_dir) return test_dir - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testAddCollectionDef(self): test_dir = self._get_test_dir("good_collection") filename = os.path.join(test_dir, "metafile") @@ -1772,13 +1772,13 @@ class MetaGraphTest(test.TestCase): v1 = sess.graph.get_tensor_by_name("v1:0") self.assertEqual(11.0, v1.eval()) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testMultiSaverCollection(self): test_dir = self._get_test_dir("saver_collection") self._testMultiSaverCollectionSave(test_dir) self._testMultiSaverCollectionRestore(test_dir) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testClearExtraneousSavers(self): test_dir = self._get_test_dir("clear_extraneous_savers") filename = os.path.join(test_dir, "metafile") @@ -1866,7 +1866,7 @@ class MetaGraphTest(test.TestCase): lambda e: "does not exist"): saver_module.import_meta_graph(filename) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testSliceVariable(self): test_dir = self._get_test_dir("slice_saver") filename = os.path.join(test_dir, "metafile") @@ -2122,7 +2122,7 @@ class MetaGraphTest(test.TestCase): lambda: math_ops.multiply(x, -1.0)))) # pylint: enable=g-long-lambda - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testStrippedOpListDef(self): with self.cached_session(): # Creates a graph. @@ -2988,7 +2988,7 @@ class CheckpointableCompatibilityTests(test.TestCase): # exception" block in Python 3. self.assertNotIn("NewCheckpointReader", cs.exception.message) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testGraphChangedForRestoreErrorRaised(self): checkpoint_directory = self.get_temp_dir() checkpoint_prefix = os.path.join(checkpoint_directory, "ckpt") @@ -3010,7 +3010,7 @@ class CheckpointableCompatibilityTests(test.TestCase): "a mismatch between the current graph and the graph"): a_saver.restore(sess=sess, save_path=save_path) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testLoadFromObjectBasedGraph(self): checkpoint_directory = self.get_temp_dir() checkpoint_prefix = os.path.join(checkpoint_directory, "ckpt") diff --git a/tensorflow/python/training/server_lib_same_variables_no_clear_test.py b/tensorflow/python/training/server_lib_same_variables_no_clear_test.py index 1b2d588f444..ff3fab9f372 100644 --- a/tensorflow/python/training/server_lib_same_variables_no_clear_test.py +++ b/tensorflow/python/training/server_lib_same_variables_no_clear_test.py @@ -34,7 +34,7 @@ class SameVariablesNoClearTest(test.TestCase): # TODO(b/34465411): Starting multiple servers with different configurations # in the same test is flaky. Move this test case back into # "server_lib_test.py" when this is no longer the case. - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testSameVariablesNoClear(self): server = server_lib.Server.create_local_server() diff --git a/tensorflow/python/training/server_lib_test.py b/tensorflow/python/training/server_lib_test.py index 323e94c257c..92cdc1c4ad0 100644 --- a/tensorflow/python/training/server_lib_test.py +++ b/tensorflow/python/training/server_lib_test.py @@ -29,6 +29,7 @@ from tensorflow.python.framework import constant_op from tensorflow.python.framework import dtypes from tensorflow.python.framework import errors_impl from tensorflow.python.framework import ops +from tensorflow.python.framework import test_util from tensorflow.python.ops import array_ops from tensorflow.python.ops import data_flow_ops from tensorflow.python.ops import math_ops @@ -55,6 +56,7 @@ class GrpcServerTest(test.TestCase): self.assertAllEqual([[4]], sess.run(e)) # TODO(mrry): Add `server.stop()` and `server.join()` when these work. + @test_util.run_v1_only("b/120545219") def testMultipleSessions(self): server = self._cached_server @@ -73,6 +75,7 @@ class GrpcServerTest(test.TestCase): # TODO(mrry): Add `server.stop()` and `server.join()` when these work. # Verifies various reset failures. + @test_util.run_v1_only("b/120545219") def testResetFails(self): # Creates variable with container name. with ops.container("test0"): @@ -146,6 +149,7 @@ class GrpcServerTest(test.TestCase): self.assertEqual(0.5, min_val) self.assertEqual(0.5, max_val) + @test_util.run_v1_only("b/120545219") def testCloseCancelsBlockingOperation(self): server = self._cached_server sess = session.Session(server.target, config=self._useRPCConfig()) @@ -207,6 +211,7 @@ class GrpcServerTest(test.TestCase): "local": ["localhost"] }, job_name="local", task_index=0) + @test_util.run_v1_only("b/120545219") def testTimeoutRaisesException(self): server = self._cached_server q = data_flow_ops.FIFOQueue(1, [dtypes.float32]) @@ -241,6 +246,7 @@ class GrpcServerTest(test.TestCase): queue_runner_impl.start_queue_runners(sess) sess.run(var.assign(3.0)) + @test_util.run_v1_only("b/120545219") def testIsolateSessionState(self): server = self._cached_server @@ -296,6 +302,7 @@ class GrpcServerTest(test.TestCase): self.assertAllEqual(37, isolate_sess_0.run(v)) self.assertAllEqual([19, 86], isolate_sess_1.run(v)) + @test_util.run_v1_only("b/120545219") def testShapeChangingIsolateState(self): server = self._cached_server sharing_config = config_pb2.ConfigProto(isolate_session_state=False) diff --git a/tensorflow/python/training/session_manager_test.py b/tensorflow/python/training/session_manager_test.py index 4294ffa8512..c9a0c56ffc1 100644 --- a/tensorflow/python/training/session_manager_test.py +++ b/tensorflow/python/training/session_manager_test.py @@ -69,7 +69,7 @@ class SessionManagerTest(test.TestCase): "", init_fn=lambda sess: sess.run(v.initializer)) self.assertAllClose([125], sess.run(v)) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testPrepareSessionFails(self): checkpoint_dir = os.path.join(self.get_temp_dir(), "prepare_session") checkpoint_dir2 = os.path.join(self.get_temp_dir(), "prepare_session2") @@ -154,7 +154,7 @@ class SessionManagerTest(test.TestCase): sess.graph.get_tensor_by_name("v:0")).eval(session=sess)) self.assertEquals(1, sess.run(v)) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testRecoverSession(self): # Create a checkpoint. checkpoint_dir = os.path.join(self.get_temp_dir(), "recover_session") @@ -187,6 +187,7 @@ class SessionManagerTest(test.TestCase): checkpoint_filename_with_path=checkpoint_management.latest_checkpoint( checkpoint_dir)) + @test_util.run_v1_only("b/120545219") def testWaitForSessionReturnsNoneAfterTimeout(self): with ops.Graph().as_default(): variables.VariableV1(1, name="v") @@ -209,7 +210,7 @@ class SessionManagerTest(test.TestCase): variables.global_variables()), local_init_op=None) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testRecoverSessionWithReadyForLocalInitOp(self): # Create a checkpoint. checkpoint_dir = os.path.join(self.get_temp_dir(), @@ -263,7 +264,7 @@ class SessionManagerTest(test.TestCase): self.assertEquals(1, sess.run(v)) self.assertEquals(1, sess.run(w)) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testRecoverSessionWithReadyForLocalInitOpFailsToReadyLocal(self): # We use ready_for_local_init_op=tf.report_uninitialized_variables(), # which causes recover_session to not run local_init_op, and to return @@ -320,7 +321,7 @@ class SessionManagerTest(test.TestCase): sess.graph.get_tensor_by_name("w:0")).eval(session=sess)) self.assertEquals(1, sess.run(v)) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testRecoverSessionNoChkptStillRunsLocalInitOp(self): # This test checks for backwards compatibility. # In particular, we continue to ensure that recover_session will execute @@ -349,7 +350,7 @@ class SessionManagerTest(test.TestCase): sess.graph.get_tensor_by_name("w:0")).eval(session=sess)) self.assertEquals(1, sess.run(w)) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testRecoverSessionFailsStillRunsLocalInitOp(self): # Create a checkpoint. checkpoint_dir = os.path.join( @@ -393,7 +394,7 @@ class SessionManagerTest(test.TestCase): sess.graph.get_tensor_by_name("w:0")).eval(session=sess)) self.assertEquals(1, sess.run(w)) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testWaitForSessionLocalInit(self): server = server_lib.Server.create_local_server() with ops.Graph().as_default() as graph: @@ -445,7 +446,7 @@ class SessionManagerTest(test.TestCase): # because of overly restrictive ready_for_local_init_op sm.wait_for_session("", max_wait_secs=3) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testWaitForSessionInsufficientReadyForLocalInitCheck(self): with ops.Graph().as_default() as graph: v = variables.VariableV1(1, name="v") @@ -463,7 +464,7 @@ class SessionManagerTest(test.TestCase): "Session was not ready after waiting.*"): sm.wait_for_session("", max_wait_secs=3) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testPrepareSessionWithReadyForLocalInitOp(self): with ops.Graph().as_default(): v = variables.VariableV1(1, name="v") @@ -503,7 +504,7 @@ class SessionManagerTest(test.TestCase): self.assertEquals(1, sess.run(w)) self.assertEquals(3, sess.run(x)) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testPrepareSessionWithPartialInitOp(self): with ops.Graph().as_default(): v = variables.VariableV1(1, name="v") @@ -570,7 +571,7 @@ class SessionManagerTest(test.TestCase): self.assertEquals(1, sess.run(w_res)) self.assertEquals(3, sess.run(x_res)) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testPrepareSessionWithCyclicInitializer(self): # Regression test. Previously Variable._build_initializer_expr would enter # into an infinite recursion when the variable's initial_value involved @@ -644,7 +645,7 @@ class SessionManagerTest(test.TestCase): "Init operations did not make model ready for local_init"): sm2.prepare_session("", init_op=None) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testPrepareSessionWithInsufficientReadyForLocalInitCheck(self): with ops.Graph().as_default(): v = variables.VariableV1(1, name="v") @@ -697,7 +698,7 @@ class ObsoleteSessionManagerTest(test.TestCase): "", init_fn=lambda sess: sess.run(v.initializer)) self.assertAllClose([125], sess.run(v)) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testPrepareSessionFails(self): checkpoint_dir = os.path.join(self.get_temp_dir(), "prepare_session") checkpoint_dir2 = os.path.join(self.get_temp_dir(), "prepare_session2") @@ -759,7 +760,7 @@ class ObsoleteSessionManagerTest(test.TestCase): variables.is_variable_initialized( sess.graph.get_tensor_by_name("v:0")).eval(session=sess)) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testRecoverSession(self): # Create a checkpoint. checkpoint_dir = os.path.join(self.get_temp_dir(), "recover_session") @@ -798,6 +799,7 @@ class ObsoleteSessionManagerTest(test.TestCase): sess.graph.get_tensor_by_name("v:0")).eval(session=sess)) self.assertEquals(1, sess.run(v)) + @test_util.run_v1_only("b/120545219") def testWaitForSessionReturnsNoneAfterTimeout(self): with ops.Graph().as_default(): variables.VariableV1(1, name="v") diff --git a/tensorflow/python/training/slot_creator_test.py b/tensorflow/python/training/slot_creator_test.py index 1f26aaa434e..f1f0d58a691 100644 --- a/tensorflow/python/training/slot_creator_test.py +++ b/tensorflow/python/training/slot_creator_test.py @@ -32,7 +32,7 @@ from tensorflow.python.training import slot_creator class SlotCreatorTest(test.TestCase): - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testCreateSlotFromVariable(self): with self.cached_session(): v = variables.Variable([1.0, 2.5], name="var") @@ -73,7 +73,7 @@ class SlotCreatorTest(test.TestCase): self.assertEqual(dtypes.float64, slot.dtype.base_dtype) self.assertAllEqual([0.0, 0.0], self.evaluate(slot)) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testCreateZerosSlotFromDynamicShapedVariable(self): with self.cached_session(): dyn_shape = constant_op.constant([2], dtype=dtypes.int32) @@ -125,7 +125,7 @@ class SlotCreatorTest(test.TestCase): self.assertEqual(dtypes.float64, slot.dtype.base_dtype) self.assertAllEqual([0.0, 0.0], self.evaluate(slot)) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testCreateSlotFromVariableRespectsScope(self): # See discussion on #2740. with self.cached_session(): diff --git a/tensorflow/python/training/supervisor_test.py b/tensorflow/python/training/supervisor_test.py index f6505acc9ac..180ddb52876 100644 --- a/tensorflow/python/training/supervisor_test.py +++ b/tensorflow/python/training/supervisor_test.py @@ -421,7 +421,7 @@ class SupervisorTest(test.TestCase): with self.assertRaisesRegexp(RuntimeError, "requires a summary writer"): sv.summary_computed(sess, sess.run(summ)) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testLogdirButExplicitlyNoSummaryWriter(self): logdir = self._test_dir("explicit_no_summary_writer") with ops.Graph().as_default(): @@ -507,7 +507,7 @@ class SupervisorTest(test.TestCase): sv = supervisor.Supervisor(logdir="", session_manager=sm) sv.prepare_or_wait_for_session("") - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testInitOp(self): logdir = self._test_dir("default_init_op") with ops.Graph().as_default(): @@ -517,7 +517,7 @@ class SupervisorTest(test.TestCase): self.assertAllClose([1.0, 2.0, 3.0], sess.run(v)) sv.stop() - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testInitFn(self): logdir = self._test_dir("default_init_op") with ops.Graph().as_default(): @@ -531,7 +531,7 @@ class SupervisorTest(test.TestCase): self.assertAllClose([1.0, 2.0, 3.0], sess.run(v)) sv.stop() - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testInitOpWithFeedDict(self): logdir = self._test_dir("feed_dict_init_op") with ops.Graph().as_default(): @@ -545,7 +545,7 @@ class SupervisorTest(test.TestCase): self.assertAllClose([1.0, 2.0, 3.0], sess.run(v)) sv.stop() - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testReadyForLocalInitOp(self): server = server_lib.Server.create_local_server() logdir = self._test_dir("default_ready_for_local_init_op") @@ -588,7 +588,7 @@ class SupervisorTest(test.TestCase): sv0.stop() sv1.stop() - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testReadyForLocalInitOpRestoreFromCheckpoint(self): server = server_lib.Server.create_local_server() logdir = self._test_dir("ready_for_local_init_op_restore") @@ -720,7 +720,7 @@ class SupervisorTest(test.TestCase): "Variables not initialized: w"): sv.prepare_or_wait_for_session(server.target) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testSetupFail(self): logdir = self._test_dir("setup_fail") with ops.Graph().as_default(): @@ -731,7 +731,7 @@ class SupervisorTest(test.TestCase): variables.VariableV1([1.0, 2.0, 3.0], name="v") supervisor.Supervisor(logdir=logdir, is_chief=False) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testDefaultGlobalStep(self): logdir = self._test_dir("default_global_step") with ops.Graph().as_default(): @@ -741,7 +741,7 @@ class SupervisorTest(test.TestCase): self.assertEquals(287, sess.run(sv.global_step)) sv.stop() - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testRestoreFromMetaGraph(self): logdir = self._test_dir("restore_from_meta_graph") with ops.Graph().as_default(): @@ -763,7 +763,7 @@ class SupervisorTest(test.TestCase): # This test is based on the fact that the standard services start # right away and get to run once before sv.stop() returns. # We still sleep a bit to make the test robust. - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testStandardServicesWithoutGlobalStep(self): logdir = self._test_dir("standard_services_without_global_step") # Create a checkpoint. @@ -814,7 +814,7 @@ class SupervisorTest(test.TestCase): # Same as testStandardServicesNoGlobalStep but with a global step. # We should get a summary about the step time. - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testStandardServicesWithGlobalStep(self): logdir = self._test_dir("standard_services_with_global_step") # Create a checkpoint. diff --git a/tensorflow/python/training/sync_replicas_optimizer_test.py b/tensorflow/python/training/sync_replicas_optimizer_test.py index 1ef8756ef67..428583d048a 100644 --- a/tensorflow/python/training/sync_replicas_optimizer_test.py +++ b/tensorflow/python/training/sync_replicas_optimizer_test.py @@ -22,6 +22,7 @@ import time from tensorflow.python.framework import constant_op from tensorflow.python.framework import ops +from tensorflow.python.framework import test_util from tensorflow.python.framework.test_util import create_local_cluster from tensorflow.python.ops import variables from tensorflow.python.platform import test @@ -88,6 +89,7 @@ class SyncReplicasOptimizerTest(test.TestCase): def _run(self, train_op, sess): sess.run(train_op) + @test_util.run_v1_only("b/120545219") def test2Workers(self): num_workers = 2 replicas_to_aggregate = 2 @@ -178,6 +180,7 @@ class SyncReplicasOptimizerTest(test.TestCase): sessions[1].run(var_1_g_1)) # 3 workers and one of them is backup. + @test_util.run_v1_only("b/120545219") def test3Workers1Backup(self): num_workers = 3 replicas_to_aggregate = 2 @@ -266,6 +269,7 @@ class SyncReplicasOptimizerHookTest(test.TestCase): "apply_gradient should be called"): hook.begin() + @test_util.run_v1_only("b/120545219") def testCanCreatedBeforeMinimizeCalled(self): """This behavior is required to be integrated with Estimators.""" opt = training.SyncReplicasOptimizer( @@ -278,6 +282,7 @@ class SyncReplicasOptimizerHookTest(test.TestCase): opt.minimize(v, global_step=global_step) hook.begin() + @test_util.run_v1_only("b/120545219") def testFetchVariableList(self): opt = training.SyncReplicasOptimizer( opt=adam.AdamOptimizer(0.01), diff --git a/tensorflow/python/training/tensorboard_logging_test.py b/tensorflow/python/training/tensorboard_logging_test.py index 5af6a0aa7b4..5088ab07e5e 100644 --- a/tensorflow/python/training/tensorboard_logging_test.py +++ b/tensorflow/python/training/tensorboard_logging_test.py @@ -25,6 +25,7 @@ import tempfile import time from tensorflow.core.util import event_pb2 +from tensorflow.python.framework import test_util from tensorflow.python.platform import test from tensorflow.python.platform import tf_logging as logging from tensorflow.python.summary import summary_iterator @@ -32,6 +33,7 @@ from tensorflow.python.summary.writer import writer from tensorflow.python.training import tensorboard_logging +@test_util.run_v1_only("b/120545219") class EventLoggingTest(test.TestCase): def setUp(self): @@ -85,6 +87,7 @@ class EventLoggingTest(test.TestCase): (event_pb2.LogMessage.ERROR, "format")]) self.assertEqual(2, self.logged_message_count) + @test_util.run_v1_only("b/120545219") def testVerbosity(self): tensorboard_logging.set_summary_writer(self._sw) tensorboard_logging.set_verbosity(tensorboard_logging.ERROR) @@ -112,6 +115,7 @@ class EventLoggingTest(test.TestCase): tensorboard_logging.warn("this should work") self.assertEqual(1, self.logged_message_count) + @test_util.run_v1_only("b/120545219") def testSummaryWriterFailsAfterClear(self): tensorboard_logging._clear_summary_writer() with self.assertRaises(RuntimeError): diff --git a/tensorflow/python/training/training_ops_test.py b/tensorflow/python/training/training_ops_test.py index 51f49ca0818..ba0f40999b4 100644 --- a/tensorflow/python/training/training_ops_test.py +++ b/tensorflow/python/training/training_ops_test.py @@ -60,7 +60,7 @@ class TrainingOpsTest(TensorFlowTestCase): self.assertShapeEqual(out, apply_sgd) self.assertAllCloseAccordingToType(x - alpha * delta, out) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testApplyGradientDescent(self): for (dtype, use_gpu) in itertools.product( [np.float16, np.float32, np.float64], [False, True]): @@ -129,7 +129,7 @@ class TrainingOpsTest(TensorFlowTestCase): self.assertAllClose(linear_update, self.evaluate(linear)) self.assertAllClose(expected_out, out) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testApplyAdagrad(self): for (dtype, use_gpu) in itertools.product( [np.float16, np.float32, np.float64], [False, True]): @@ -139,7 +139,7 @@ class TrainingOpsTest(TensorFlowTestCase): grad = np.arange(100).astype(dtype) self._testTypesForAdagrad(x, y, lr, grad, use_gpu) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testApplyFtrl(self): for dtype in [np.float16, np.float32, np.float64]: x = np.arange(100).astype(dtype) @@ -211,7 +211,7 @@ class TrainingOpsTest(TensorFlowTestCase): self.assertAllCloseAccordingToType(y[index] + grad[i] * grad[i], self.evaluate(accum)[index]) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testSparseApplyAdagrad(self): for (dtype, index_type) in itertools.product( [np.float16, np.float32, np.float64], [np.int32, np.int64]): @@ -225,7 +225,7 @@ class TrainingOpsTest(TensorFlowTestCase): indices = np.array([0, 2]).astype(index_type) self._testTypesForSparseAdagrad(x, y, lr, grad, indices) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testSparseApplyAdagradDim1(self): for (dtype, index_type) in itertools.product( [np.float16, np.float32, np.float64], [np.int32, np.int64]): @@ -239,7 +239,7 @@ class TrainingOpsTest(TensorFlowTestCase): indices = np.array([0, 2]).astype(index_type) self._testTypesForSparseAdagrad(x, y, lr, grad, indices) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testSparseApplyFtrlDim1(self): for (dtype, index_type) in itertools.product( [np.float16, np.float32, np.float64], [np.int32, np.int64]): @@ -255,7 +255,7 @@ class TrainingOpsTest(TensorFlowTestCase): indices = np.array([0, 2]).astype(index_type) self._testTypesForSparseFtrl(x, y, z, lr, grad, indices) - @test_util.run_deprecated_v1 + @test_util.run_v1_only("b/120545219") def testApplyAdam(self): for dtype, use_gpu in itertools.product( [np.float16, np.float32, np.float64], [False, True]): diff --git a/tensorflow/python/training/training_util_test.py b/tensorflow/python/training/training_util_test.py index 3317008fce0..3f9858a33ba 100644 --- a/tensorflow/python/training/training_util_test.py +++ b/tensorflow/python/training/training_util_test.py @@ -27,6 +27,7 @@ from tensorflow.python.training import monitored_session from tensorflow.python.training import training_util +@test_util.run_v1_only('b/120545219') class GlobalStepTest(test.TestCase): def _assert_global_step(self, global_step, expected_dtype=dtypes.int64): @@ -47,7 +48,6 @@ class GlobalStepTest(test.TestCase): self.assertRaisesRegexp(TypeError, 'does not have integer type', training_util.get_global_step, g) - @test_util.run_deprecated_v1 def test_invalid_shape(self): with ops.Graph().as_default() as g: self.assertIsNone(training_util.get_global_step()) @@ -72,7 +72,6 @@ class GlobalStepTest(test.TestCase): training_util.create_global_step, g) self._assert_global_step(training_util.create_global_step(ops.Graph())) - @test_util.run_deprecated_v1 def test_get_global_step(self): with ops.Graph().as_default() as g: self.assertIsNone(training_util.get_global_step()) @@ -93,6 +92,7 @@ class GlobalStepTest(test.TestCase): self._assert_global_step(training_util.get_or_create_global_step(g)) +@test_util.run_v1_only('b/120545219') class GlobalStepReadTest(test.TestCase): def test_global_step_read_is_none_if_there_is_no_global_step(self): diff --git a/tensorflow/tools/api/tests/api_compatibility_test.py b/tensorflow/tools/api/tests/api_compatibility_test.py index 40162daf141..723fceef413 100644 --- a/tensorflow/tools/api/tests/api_compatibility_test.py +++ b/tensorflow/tools/api/tests/api_compatibility_test.py @@ -314,7 +314,7 @@ class ApiCompatibilityTest(test.TestCase): update_goldens=FLAGS.update_goldens, api_version=api_version) - @test_util.run_deprecated_v1 + @test_util.run_v1_only('b/120545219') def testAPIBackwardsCompatibility(self): api_version = 1 golden_file_pattern = os.path.join( @@ -333,7 +333,7 @@ class ApiCompatibilityTest(test.TestCase): 'tensorflow.python.util.lazy_loader.LazyLoader' in str(type(tf.contrib))) - @test_util.run_deprecated_v1 + @test_util.run_v1_only('b/120545219') def testAPIBackwardsCompatibilityV1(self): api_version = 1 golden_file_pattern = os.path.join( diff --git a/tensorflow/tools/compatibility/testdata/test_file_v0_11.py b/tensorflow/tools/compatibility/testdata/test_file_v0_11.py index 68ba7a2630c..917236da4b4 100644 --- a/tensorflow/tools/compatibility/testdata/test_file_v0_11.py +++ b/tensorflow/tools/compatibility/testdata/test_file_v0_11.py @@ -34,6 +34,7 @@ class TestUpgrade(test_util.TensorFlowTestCase): a unit test if the converter is successful. """ + @test_util.run_v1_only("b/120545219") def testArgRenames(self): with self.cached_session(): @@ -97,6 +98,7 @@ class TestUpgrade(test_util.TensorFlowTestCase): tf.expand_dims([[1, 2], [3, 4]], axis=1).eval(), [[[1, 2]], [[3, 4]]]) + @test_util.run_v1_only("b/120545219") def testArgMinMax(self): with self.cached_session(): self.assertAllEqual( @@ -112,6 +114,7 @@ class TestUpgrade(test_util.TensorFlowTestCase): tf.argmax([[1, 2, 3], [4, 1, 0]], dimension=0).eval(), [1, 0, 0]) + @test_util.run_v1_only("b/120545219") def testExpandAndSqueeze(self): with self.cached_session(): @@ -139,6 +142,7 @@ class TestUpgrade(test_util.TensorFlowTestCase): [[1, 2, 3]], dim=1), squeeze_dims=[1]).eval(), a) + @test_util.run_v1_only("b/120545219") def testArithmeticRenames(self): with self.cached_session() as s: stuff = tf.split(1, 2, [[1, 2, 3, 4], [4, 5, 6, 7]]) @@ -163,6 +167,7 @@ class TestUpgrade(test_util.TensorFlowTestCase): # # TODO(aselle): (tf.batch_*) # ] + @test_util.run_v1_only("b/120545219") def testBatchAndSvd(self): with self.cached_session(): mat = [[1., 2.], [2., 3.]] @@ -174,6 +179,7 @@ class TestUpgrade(test_util.TensorFlowTestCase): tf.svd(mat, False, True).eval(), tf.svd(mat, compute_uv=False, full_matrices=True).eval()) + @test_util.run_v1_only("b/120545219") def testCrossEntropy(self): # TODO(aselle): Test sparse_softmax_... with self.cached_session(): @@ -190,6 +196,7 @@ class TestUpgrade(test_util.TensorFlowTestCase): tf.nn.sigmoid_cross_entropy_with_logits( labels=labels, logits=logits).eval()) + @test_util.run_v1_only("b/120545219") def testVariables(self): with self.cached_session() as s: @@ -200,6 +207,7 @@ class TestUpgrade(test_util.TensorFlowTestCase): _ = [v.name for v in tf.all_variables()] _ = [v.name for v in tf.local_variables()] + @test_util.run_v1_only("b/120545219") def testSummaries(self): with self.cached_session() as s: var = tf.Variable([1, 2, 3], dtype=tf.float32) diff --git a/tensorflow/tools/compatibility/testdata/test_file_v1_12.py b/tensorflow/tools/compatibility/testdata/test_file_v1_12.py index fd688781b0d..5ce4dd49adc 100644 --- a/tensorflow/tools/compatibility/testdata/test_file_v1_12.py +++ b/tensorflow/tools/compatibility/testdata/test_file_v1_12.py @@ -28,11 +28,13 @@ class TestUpgrade(test_util.TensorFlowTestCase): def setUp(self): tf.enable_eager_execution() + @test_util.run_v1_only("b/120545219") def testRenames(self): with self.cached_session(): self.assertAllClose(1.04719755, tf.acos(0.5)) self.assertAllClose(0.5, tf.rsqrt(4.0)) + @test_util.run_v1_only("b/120545219") def testSerializeSparseTensor(self): sp_input = tf.SparseTensor( indices=tf.constant([[1]], dtype=tf.int64), @@ -44,6 +46,7 @@ class TestUpgrade(test_util.TensorFlowTestCase): self.assertEqual((3,), serialized_sp.shape) self.assertTrue(serialized_sp[0].numpy()) # check non-empty + @test_util.run_v1_only("b/120545219") def testSerializeManySparse(self): sp_input = tf.SparseTensor( indices=tf.constant([[0, 1]], dtype=tf.int64), @@ -55,6 +58,7 @@ class TestUpgrade(test_util.TensorFlowTestCase): sp_input, 'serialize_name', tf.string) self.assertEqual((1, 3), serialized_sp.shape) + @test_util.run_v1_only("b/120545219") def testArgMaxMin(self): self.assertAllClose( [1],