diff options
author | 2018-03-26 10:00:20 -0700 | |
---|---|---|
committer | 2018-03-26 10:02:37 -0700 | |
commit | 2b078a508b8c6c920db121f676650d7972749bd7 (patch) | |
tree | 95366777558b375058f94d1f00d1944f1f8f0803 /tensorflow | |
parent | a5a1e9e43131b387395930f38234fc10b02d874b (diff) |
Automated g4 rollback of changelist 190293303
PiperOrigin-RevId: 190479555
Diffstat (limited to 'tensorflow')
-rw-r--r-- | tensorflow/c/BUILD | 2 | ||||
-rw-r--r-- | tensorflow/c/python_api.cc | 26 | ||||
-rw-r--r-- | tensorflow/c/python_api.h | 7 | ||||
-rw-r--r-- | tensorflow/python/BUILD | 2 | ||||
-rw-r--r-- | tensorflow/python/client/tf_session.i | 1 | ||||
-rw-r--r-- | tensorflow/python/framework/importer_test.py | 34 | ||||
-rw-r--r-- | tensorflow/python/framework/ops.py | 10 |
7 files changed, 0 insertions, 82 deletions
diff --git a/tensorflow/c/BUILD b/tensorflow/c/BUILD index f4a486d330..d096647558 100644 --- a/tensorflow/c/BUILD +++ b/tensorflow/c/BUILD @@ -279,8 +279,6 @@ tf_cuda_library( deps = [ ":c_api", ":c_api_internal", - # TODO(b/74620627): remove when _USE_C_SHAPES is removed - "//tensorflow/python:cpp_shape_inference_proto_cc", ], ) diff --git a/tensorflow/c/python_api.cc b/tensorflow/c/python_api.cc index 93155998b8..cd604538f1 100644 --- a/tensorflow/c/python_api.cc +++ b/tensorflow/c/python_api.cc @@ -16,7 +16,6 @@ limitations under the License. #include "tensorflow/c/python_api.h" #include "tensorflow/c/c_api_internal.h" -#include "tensorflow/python/framework/cpp_shape_inference.pb.h" namespace tensorflow { @@ -110,29 +109,4 @@ void ExtendSession(TF_Session* session, TF_Status* status) { session->extend_before_run = false; } -std::string ResourceHandleShapeAndType(TF_Graph* graph, TF_Output output) { - Node* node = &output.oper->node; - CppShapeInferenceResult::HandleData handle_data; - handle_data.set_is_set(true); - { - mutex_lock l(graph->mu); - tensorflow::shape_inference::InferenceContext* ic = - graph->refiner.GetContext(node); - CHECK(ic != nullptr); - CHECK_LT(output.index, ic->num_outputs()); - const auto* shapes_and_types = - ic->output_handle_shapes_and_types(output.index); - if (shapes_and_types == nullptr) return ""; - - for (const auto& p : *shapes_and_types) { - auto* out_shape_and_type = handle_data.add_shape_and_type(); - ic->ShapeHandleToProto(p.shape, out_shape_and_type->mutable_shape()); - out_shape_and_type->set_dtype(p.dtype); - } - } - string result; - handle_data.SerializeToString(&result); - return result; -} - } // namespace tensorflow diff --git a/tensorflow/c/python_api.h b/tensorflow/c/python_api.h index 2d4c8cd9ed..13b680b3a2 100644 --- a/tensorflow/c/python_api.h +++ b/tensorflow/c/python_api.h @@ -16,8 +16,6 @@ limitations under the License. #ifndef TENSORFLOW_C_PYTHON_API_H_ #define TENSORFLOW_C_PYTHON_API_H_ -#include <string> - #include "tensorflow/c/c_api.h" // These functions can be removed without notice. They exist to facilitate some @@ -53,11 +51,6 @@ void SetRequireShapeInferenceFns(TF_Graph* graph, bool require); // the graph after the session has been made aware of them. void ExtendSession(TF_Session* session, TF_Status* status); -// Returns the serialized CppShapeInferenceResult::HandleData proto for -// `output` if its a resource tensor, or otherwise returns the empty string. -// TODO(b/74620627): remove when _USE_C_SHAPES is removed -std::string ResourceHandleShapeAndType(TF_Graph* graph, TF_Output output); - } // namespace tensorflow #endif // TENSORFLOW_C_PYTHON_API_H_ diff --git a/tensorflow/python/BUILD b/tensorflow/python/BUILD index e6ad564ede..30ecc477f2 100644 --- a/tensorflow/python/BUILD +++ b/tensorflow/python/BUILD @@ -3131,8 +3131,6 @@ tf_proto_library( srcs = ["framework/cpp_shape_inference.proto"], cc_api_version = 2, protodeps = tf_additional_all_protos(), - # TODO(b/74620627): remove when _USE_C_SHAPES is removed - visibility = ["//tensorflow:internal"], ) py_test( diff --git a/tensorflow/python/client/tf_session.i b/tensorflow/python/client/tf_session.i index 70a3d032f4..e88fc0c01a 100644 --- a/tensorflow/python/client/tf_session.i +++ b/tensorflow/python/client/tf_session.i @@ -723,7 +723,6 @@ def TF_Reset(target, containers=None, config=None): %unignore TF_TryEvaluateConstant_wrapper; %noexception TF_TryEvaluateConstant_wrapper; %unignore ExtendSession; -%unignore ResourceHandleShapeAndType; %include "tensorflow/python/client/tf_session_helper.h" diff --git a/tensorflow/python/framework/importer_test.py b/tensorflow/python/framework/importer_test.py index 369669c2e6..6593b17184 100644 --- a/tensorflow/python/framework/importer_test.py +++ b/tensorflow/python/framework/importer_test.py @@ -39,7 +39,6 @@ from tensorflow.python.ops import gradients_impl from tensorflow.python.ops import math_ops from tensorflow.python.ops import nn_ops from tensorflow.python.ops import random_ops -from tensorflow.python.ops import resource_variable_ops from tensorflow.python.ops import variables import tensorflow.python.ops.nn_grad # pylint: disable=unused-import from tensorflow.python.platform import test @@ -357,39 +356,6 @@ class ImportGraphDefTest(test.TestCase): self.assertEqual(d._input_types, [dtypes.int32_ref, dtypes.int32]) self.assertEqual(d.outputs, []) - def testResources(self): - # Produce GraphDef containing a ops producing and consuming resources. - graph = ops.Graph() - with graph.as_default(): - var = resource_variable_ops.ResourceVariable(1.0) - var_assign = var.assign(2.0) - # Use an op that requires handle shape to be set. - var_shape = resource_variable_ops.variable_shape(var.handle) - init = variables.global_variables_initializer() - graph_def = graph.as_graph_def() - - # Import the GraphDef. - with ops.Graph().as_default(): - # pylint: disable=unused-variable - imported_var, imported_assign, imported_shape, imported_init = ( - importer.import_graph_def( - graph_def, - return_elements=[var.name, var_assign.name, var_shape.name, - init.name])) - - # Make sure the handle shape is set on the imported variable. - new_var_shape = resource_variable_ops.variable_shape(imported_var) - # pylint: enable=unused-variable - - # Run the imported graph. - # TODO(b/76173421): make this work (currently DCHECKS) - # with self.test_session() as sess: - # sess.run(imported_init) - # self.assertEqual(sess.run(imported_var), 1.0) - # self.assertEqual(sess.run(imported_assign), 2.0) - # self.assertEqual(list(sess.run(imported_shape)), []) - # self.assertEqual(list(sess.run(new_var_shape)), []) - def testWhileLoop(self): # Produce GraphDef containing while loop. graph = ops.Graph() diff --git a/tensorflow/python/framework/ops.py b/tensorflow/python/framework/ops.py index 5e4a884a70..e579289a8d 100644 --- a/tensorflow/python/framework/ops.py +++ b/tensorflow/python/framework/ops.py @@ -42,7 +42,6 @@ from tensorflow.python.eager import context from tensorflow.python.eager import core from tensorflow.python.eager import tape from tensorflow.python.framework import c_api_util -from tensorflow.python.framework import cpp_shape_inference_pb2 from tensorflow.python.framework import device as pydev from tensorflow.python.framework import dtypes from tensorflow.python.framework import errors @@ -296,7 +295,6 @@ class Tensor(_TensorLike): # Attributes used for C++ shape inference. Not inspected, only forwarded. # If set, will be a HandleData object from cpp_shape_inference.proto. - # TODO(b/74620627): remove when _USE_C_SHAPES is removed self._handle_data = None self._id = uid() @@ -2474,14 +2472,6 @@ def _set_shapes_for_outputs_c_api(op): shape_vector = [None if d == -1 else d for d in shape_vector] output.set_shape(tensor_shape.TensorShape(shape_vector)) - serialized = c_api.ResourceHandleShapeAndType(op._graph._c_graph, - output._as_tf_output()) - if serialized: - output._handle_data = ( - cpp_shape_inference_pb2.CppShapeInferenceResult.HandleData.FromString( - compat.as_bytes(serialized))) - else: - output._handle_data = None # TODO(skyewm): remove this when _USE_C_API flag is removed. def _set_shapes_for_outputs(op): |