From b05c0ee7541f7c7fe5db58de061cbc5697483195 Mon Sep 17 00:00:00 2001 From: Saurabh Saxena Date: Tue, 9 Jul 2019 10:55:31 -0700 Subject: [PATCH] Fix keras/backend_test for v2 control flow. PiperOrigin-RevId: 257228448 --- tensorflow/python/keras/backend.py | 4 ++-- tensorflow/python/keras/backend_test.py | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/tensorflow/python/keras/backend.py b/tensorflow/python/keras/backend.py index ce557b834d5..c7ebb4b2524 100644 --- a/tensorflow/python/keras/backend.py +++ b/tensorflow/python/keras/backend.py @@ -5429,9 +5429,9 @@ def ctc_label_dense_to_sparse(labels, label_lengths): num_batches_tns = array_ops.stack([label_shape[0]]) max_num_labels_tns = array_ops.stack([label_shape[1]]) - def range_less_than(_, current_input): + def range_less_than(old_input, current_input): return array_ops.expand_dims( - math_ops.range(label_shape[1]), 0) < array_ops.fill( + math_ops.range(array_ops.shape(old_input)[1]), 0) < array_ops.fill( max_num_labels_tns, current_input) init = math_ops.cast( diff --git a/tensorflow/python/keras/backend_test.py b/tensorflow/python/keras/backend_test.py index e3bc5467261..51b57d2d1ff 100644 --- a/tensorflow/python/keras/backend_test.py +++ b/tensorflow/python/keras/backend_test.py @@ -1661,6 +1661,7 @@ class BackendCrossEntropyLossesTest(test.TestCase): @test_util.run_all_in_graph_and_eager_modes +@test_util.with_control_flow_v2 class TestCTC(test.TestCase): def test_ctc_decode(self):