From 278e68cedbb80c6f3342856bfccf688a808e461a Mon Sep 17 00:00:00 2001 From: Benoit Steiner Date: Thu, 3 May 2018 13:09:28 -0700 Subject: [PATCH] Simplified the implementation of shape_n since the optimized code path isn't needed anymore and can be incorrect in some rare cases. PiperOrigin-RevId: 195298813 --- tensorflow/python/ops/array_ops.py | 10 +--------- tensorflow/python/profiler/model_analyzer_test.py | 2 +- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/tensorflow/python/ops/array_ops.py b/tensorflow/python/ops/array_ops.py index e235047..96df156 100644 --- a/tensorflow/python/ops/array_ops.py +++ b/tensorflow/python/ops/array_ops.py @@ -263,15 +263,7 @@ def shape_n(input, out_type=dtypes.int32, name=None): type `out_type`. """ - output = gen_array_ops.shape_n(input, out_type=out_type, name=name) - if not context.executing_eagerly(): - for i, input_tensor in enumerate(input): - input_tensor = ops.convert_to_tensor(input_tensor) - input_shape = input_tensor.get_shape() - if input_shape.is_fully_defined(): - output[i] = constant( - input_shape.as_list(), dtype=out_type, name=name) - return output + return gen_array_ops.shape_n(input, out_type=out_type, name=name) @tf_export("size") diff --git a/tensorflow/python/profiler/model_analyzer_test.py b/tensorflow/python/profiler/model_analyzer_test.py index 04ba28c..75580fc 100644 --- a/tensorflow/python/profiler/model_analyzer_test.py +++ b/tensorflow/python/profiler/model_analyzer_test.py @@ -232,7 +232,7 @@ class PrintModelAnalysisTest(test.TestCase): self.assertLess(0, tfprof_node.total_exec_micros) self.assertEqual(2844, tfprof_node.total_parameters) - self.assertLess(168800, tfprof_node.total_float_ops) + self.assertLess(145660, tfprof_node.total_float_ops) self.assertEqual(8, len(tfprof_node.children)) self.assertEqual('_TFProfRoot', tfprof_node.name) self.assertEqual( -- 2.7.4