[TF2XLA] [NFC] Test case for uninitialized tensor array due to dynamic size

PiperOrigin-RevId: 348732190
Change-Id: I419f2211a70e95e96bd9d44bd66ee271321b006a
This commit is contained in:
George Karpenkov 2020-12-22 19:53:56 -08:00 committed by TensorFlower Gardener
parent d0a597a129
commit 907bde43cc

View File

@ -871,6 +871,24 @@ class DefFunctionTest(xla_test.XLATestCase):
f(constant_op.constant(1))
@test_util.disable_mlir_bridge('TODO(b/155782411): MLIR bridge does not'
'support stack traces')
def testTensorArrayErrorMessage(self):
with ops.device('device:{}:0'.format(self.device)):
@def_function.function(jit_compile=True)
def f():
ta = tensor_array_ops.TensorArray(
dtype=dtypes.float32,
size=2,
dynamic_size=True,
element_shape=(None,))
return ta.concat() # EXPECTED_MESSAGE
with self.assertRaisesRegex(errors.InvalidArgumentError,
'EXPECTED_MESSAGE'):
f()
if __name__ == '__main__':
ops.enable_eager_execution()