[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
This commit is contained in:
parent
bbe0c4590c
commit
0d40f59242
|
@ -486,7 +486,7 @@ class SliceAssignTest(xla_test.XLATestCase):
|
||||||
|
|
||||||
def testUninitialized(self):
|
def testUninitialized(self):
|
||||||
with self.assertRaisesRegexp(errors.FailedPreconditionError,
|
with self.assertRaisesRegexp(errors.FailedPreconditionError,
|
||||||
"Read variable failure"):
|
"uninitialized"):
|
||||||
with self.session() as sess, self.test_scope():
|
with self.session() as sess, self.test_scope():
|
||||||
v = resource_variable_ops.ResourceVariable([1, 2])
|
v = resource_variable_ops.ResourceVariable([1, 2])
|
||||||
sess.run(v[:].assign([1, 2]))
|
sess.run(v[:].assign([1, 2]))
|
||||||
|
|
|
@ -415,7 +415,7 @@ Status ReadVariableInputTensor(const Tensor& tensor, DataType type,
|
||||||
if (!variable->initialized()) {
|
if (!variable->initialized()) {
|
||||||
return errors::FailedPrecondition(
|
return errors::FailedPrecondition(
|
||||||
"Read variable failure ", variable->name(),
|
"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 ");
|
"another device ");
|
||||||
}
|
}
|
||||||
if (variable->type() != type) {
|
if (variable->type() != type) {
|
||||||
|
@ -468,7 +468,7 @@ Status XlaOpKernelContext::GetVariableTypeAndShape(int index, DataType* type,
|
||||||
if (!variable->initialized()) {
|
if (!variable->initialized()) {
|
||||||
return errors::InvalidArgument(
|
return errors::InvalidArgument(
|
||||||
"Read variable failure ", variable->name(),
|
"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 ");
|
"another device ");
|
||||||
}
|
}
|
||||||
*type = variable->type();
|
*type = variable->type();
|
||||||
|
|
|
@ -1072,8 +1072,7 @@ class ResourceVariableOpsTest(test_util.TensorFlowTestCase,
|
||||||
dtype=v.dtype.base_dtype, shape=v.get_shape(), shared_name="var5",
|
dtype=v.dtype.base_dtype, shape=v.get_shape(), shared_name="var5",
|
||||||
container=ops.get_default_graph()._container)
|
container=ops.get_default_graph()._container)
|
||||||
with self.assertRaisesOpError(
|
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()
|
resource_variable_ops.read_variable_op(x, v.dtype.base_dtype).eval()
|
||||||
|
|
||||||
@test_util.run_deprecated_v1
|
@test_util.run_deprecated_v1
|
||||||
|
|
Loading…
Reference in New Issue