From 0d40f59242fa683a408533ac563deb81b97166fa Mon Sep 17 00:00:00 2001 From: "A. Unique TensorFlower" Date: Tue, 9 Jun 2020 19:15:05 -0700 Subject: [PATCH] [TF:XLA] Update an error message to include the word "uninitialized" because many tests depend on that word being in the error message. Additional update tests that search for an outdated error message to just search for "uninitialized". PiperOrigin-RevId: 315608436 Change-Id: If696f9545f4a55d5268f842d856273781afaffe4 --- tensorflow/compiler/tests/variable_ops_test.py | 2 +- tensorflow/compiler/tf2xla/xla_op_kernel.cc | 4 ++-- tensorflow/python/kernel_tests/resource_variable_ops_test.py | 3 +-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/tensorflow/compiler/tests/variable_ops_test.py b/tensorflow/compiler/tests/variable_ops_test.py index aeafc993a5b..2514a0a9dc4 100644 --- a/tensorflow/compiler/tests/variable_ops_test.py +++ b/tensorflow/compiler/tests/variable_ops_test.py @@ -486,7 +486,7 @@ class SliceAssignTest(xla_test.XLATestCase): def testUninitialized(self): with self.assertRaisesRegexp(errors.FailedPreconditionError, - "Read variable failure"): + "uninitialized"): with self.session() as sess, self.test_scope(): v = resource_variable_ops.ResourceVariable([1, 2]) sess.run(v[:].assign([1, 2])) diff --git a/tensorflow/compiler/tf2xla/xla_op_kernel.cc b/tensorflow/compiler/tf2xla/xla_op_kernel.cc index a72e3fd44dd..27766408716 100644 --- a/tensorflow/compiler/tf2xla/xla_op_kernel.cc +++ b/tensorflow/compiler/tf2xla/xla_op_kernel.cc @@ -415,7 +415,7 @@ Status ReadVariableInputTensor(const Tensor& tensor, DataType type, if (!variable->initialized()) { return errors::FailedPrecondition( "Read variable failure ", variable->name(), - ". It could mean the variable is not initialized or the variable is on " + ". It could mean the variable is uninitialized or the variable is on " "another device "); } if (variable->type() != type) { @@ -468,7 +468,7 @@ Status XlaOpKernelContext::GetVariableTypeAndShape(int index, DataType* type, if (!variable->initialized()) { return errors::InvalidArgument( "Read variable failure ", variable->name(), - ". It could mean the variable is not initialized or the variable is on " + ". It could mean the variable is uninitialized or the variable is on " "another device "); } *type = variable->type(); diff --git a/tensorflow/python/kernel_tests/resource_variable_ops_test.py b/tensorflow/python/kernel_tests/resource_variable_ops_test.py index bf229943fd4..b45e9dfb2bc 100644 --- a/tensorflow/python/kernel_tests/resource_variable_ops_test.py +++ b/tensorflow/python/kernel_tests/resource_variable_ops_test.py @@ -1072,8 +1072,7 @@ class ResourceVariableOpsTest(test_util.TensorFlowTestCase, dtype=v.dtype.base_dtype, shape=v.get_shape(), shared_name="var5", container=ops.get_default_graph()._container) with self.assertRaisesOpError( - "(Resource .*/var5/.* does not exist|Read of uninitialized variable)" - ): + "(Resource .*/var5/.* does not exist|uninitialized)"): resource_variable_ops.read_variable_op(x, v.dtype.base_dtype).eval() @test_util.run_deprecated_v1