Another handle_data fix for graph-mode functions.
authorSkye Wanderman-Milne <skyewm@google.com>
Thu, 31 May 2018 16:43:30 +0000 (09:43 -0700)
committerTensorFlower Gardener <gardener@tensorflow.org>
Thu, 31 May 2018 16:46:01 +0000 (09:46 -0700)
PiperOrigin-RevId: 198734229

tensorflow/python/framework/function.py

index 0675222..259cab6 100644 (file)
@@ -718,8 +718,12 @@ class _FuncGraph(ops.Graph):
           tensor.dtype, shape=tensor.get_shape(), name=name)
     # pylint: disable=protected-access
     if ops._USE_C_SHAPES:
-      handle_data = c_api.GetResourceHandleShapeAndType(tensor.graph._c_graph,
-                                                        tensor._as_tf_output())
+      if isinstance(tensor, ops.EagerTensor):
+        handle_data = tensor._handle_data
+      else:
+        handle_data = c_api.GetResourceHandleShapeAndType(
+            tensor.graph._c_graph, tensor._as_tf_output())
+
       if handle_data:
         c_api.SetResourceHandleShapeAndType(ph.graph._c_graph,
                                             ph._as_tf_output(),