From ef3d7c93ee438ce943347ac7ae913680df23f5d3 Mon Sep 17 00:00:00 2001 From: Alexandre Passos Date: Mon, 9 Apr 2018 14:56:18 -0700 Subject: [PATCH] Acknowledges tape in graph mode doesn't like unknown shapes PiperOrigin-RevId: 192192757 --- tensorflow/python/kernel_tests/list_ops_test.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/tensorflow/python/kernel_tests/list_ops_test.py b/tensorflow/python/kernel_tests/list_ops_test.py index d969f0e..6173a1d 100644 --- a/tensorflow/python/kernel_tests/list_ops_test.py +++ b/tensorflow/python/kernel_tests/list_ops_test.py @@ -31,7 +31,6 @@ from tensorflow.python.framework import ops from tensorflow.python.framework import test_util from tensorflow.python.ops import array_ops from tensorflow.python.ops import control_flow_ops -from tensorflow.python.ops import gradients from tensorflow.python.ops import list_ops from tensorflow.python.ops import math_ops from tensorflow.python.ops import state_ops @@ -266,13 +265,10 @@ class ListOpsTest(test_util.TensorFlowTestCase): c = constant_op.constant([1.0, 2.0]) tape.watch(c) l = list_ops.tensor_list_from_tensor(c, element_shape=scalar_shape()) - c2 = list_ops.tensor_list_stack(l, element_dtype=dtypes.float32) + c2 = list_ops.tensor_list_stack( + l, element_dtype=dtypes.float32, num_elements=2) result = c2 * 2.0 - if context.in_eager_mode(): - # TODO(b/77609620): Fix this in graph mode. - grad = tape.gradient(result, [c])[0] - else: - grad = gradients.gradients(result, [c])[0] + grad = tape.gradient(result, [c])[0] self.assertAllEqual(self.evaluate(grad), [2.0, 2.0]) @test_util.run_in_graph_and_eager_modes() -- 2.7.4