Simplified the implementation of shape_n since the optimized code path isn't needed...
authorBenoit Steiner <bsteiner@google.com>
Thu, 3 May 2018 20:09:28 +0000 (13:09 -0700)
committerTensorFlower Gardener <gardener@tensorflow.org>
Thu, 3 May 2018 20:42:35 +0000 (13:42 -0700)
PiperOrigin-RevId: 195298813

tensorflow/python/ops/array_ops.py
tensorflow/python/profiler/model_analyzer_test.py

index e235047..96df156 100644 (file)
@@ -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")
index 04ba28c..75580fc 100644 (file)
@@ -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(