diff options
author | A. Unique TensorFlower <gardener@tensorflow.org> | 2018-09-06 13:27:29 -0700 |
---|---|---|
committer | TensorFlower Gardener <gardener@tensorflow.org> | 2018-09-06 13:39:49 -0700 |
commit | 553ce1ff813fe7436ed3d6f194290e6703e2c179 (patch) | |
tree | 67ddd714842d09586f54c15f620292f6d34bbd7c /tensorflow/python/saved_model | |
parent | 415325956eac9ffc6cf59584ed26554356741aae (diff) |
Remove unused and non public get_signature_def* methods from saved_model/signature_def_utils
PiperOrigin-RevId: 211858972
Diffstat (limited to 'tensorflow/python/saved_model')
-rw-r--r-- | tensorflow/python/saved_model/BUILD | 1 | ||||
-rw-r--r-- | tensorflow/python/saved_model/signature_def_utils_impl.py | 79 | ||||
-rw-r--r-- | tensorflow/python/saved_model/signature_def_utils_test.py | 38 |
3 files changed, 1 insertions, 117 deletions
diff --git a/tensorflow/python/saved_model/BUILD b/tensorflow/python/saved_model/BUILD index 7a37eda5ea..c9bc33e218 100644 --- a/tensorflow/python/saved_model/BUILD +++ b/tensorflow/python/saved_model/BUILD @@ -225,6 +225,7 @@ py_library( ":signature_constants", ":utils", "//tensorflow/core:protos_all_py", + "//tensorflow/python:framework_ops", "//tensorflow/python:util", ], ) diff --git a/tensorflow/python/saved_model/signature_def_utils_impl.py b/tensorflow/python/saved_model/signature_def_utils_impl.py index f8ad788f77..37f927f381 100644 --- a/tensorflow/python/saved_model/signature_def_utils_impl.py +++ b/tensorflow/python/saved_model/signature_def_utils_impl.py @@ -21,9 +21,7 @@ from __future__ import print_function from tensorflow.core.framework import types_pb2 from tensorflow.core.protobuf import meta_graph_pb2 -from tensorflow.python.framework import dtypes from tensorflow.python.framework import ops -from tensorflow.python.framework import tensor_shape from tensorflow.python.saved_model import signature_constants from tensorflow.python.saved_model import utils from tensorflow.python.util.tf_export import tf_export @@ -316,80 +314,3 @@ def _is_valid_classification_signature(signature_def): return True - -def _get_shapes_from_tensor_info_dict(tensor_info_dict): - """Returns a map of keys to TensorShape objects. - - Args: - tensor_info_dict: map with TensorInfo proto as values. - - Returns: - Map with corresponding TensorShape objects as values. - """ - return { - key: tensor_shape.TensorShape(tensor_info.tensor_shape) - for key, tensor_info in tensor_info_dict.items() - } - - -def _get_types_from_tensor_info_dict(tensor_info_dict): - """Returns a map of keys to DType objects. - - Args: - tensor_info_dict: map with TensorInfo proto as values. - - Returns: - Map with corresponding DType objects as values. - """ - return { - key: dtypes.DType(tensor_info.dtype) - for key, tensor_info in tensor_info_dict.items() - } - - -def get_signature_def_input_shapes(signature): - """Returns map of parameter names to their shapes. - - Args: - signature: SignatureDef proto. - - Returns: - Map from string to TensorShape objects. - """ - return _get_shapes_from_tensor_info_dict(signature.inputs) - - -def get_signature_def_input_types(signature): - """Returns map of output names to their types. - - Args: - signature: SignatureDef proto. - - Returns: - Map from string to DType objects. - """ - return _get_types_from_tensor_info_dict(signature.inputs) - - -def get_signature_def_output_shapes(signature): - """Returns map of output names to their shapes. - - Args: - signature: SignatureDef proto. - - Returns: - Map from string to TensorShape objects. - """ - return _get_shapes_from_tensor_info_dict(signature.outputs) - - -def get_signature_def_output_types(signature): - """Returns map of output names to their types. - - Args: - signature: SignatureDef proto. - - Returns: - Map from string to DType objects. - """ - return _get_types_from_tensor_info_dict(signature.outputs) diff --git a/tensorflow/python/saved_model/signature_def_utils_test.py b/tensorflow/python/saved_model/signature_def_utils_test.py index ebc5450633..18c55d8d33 100644 --- a/tensorflow/python/saved_model/signature_def_utils_test.py +++ b/tensorflow/python/saved_model/signature_def_utils_test.py @@ -275,44 +275,6 @@ class SignatureDefUtilsTest(test.TestCase): self.assertEqual(method_name, signature_def.method_name) self.assertEqual(3, len(signature_def.outputs)) - def testGetShapeAndTypes(self): - inputs = { - "input-1": constant_op.constant(["a", "b"]), - "input-2": array_ops.placeholder(dtypes.float32, [10, 11]), - } - outputs = { - "output-1": array_ops.placeholder(dtypes.float32, [10, 32]), - "output-2": constant_op.constant([["b"]]), - } - signature_def = _make_signature(inputs, outputs) - self.assertEqual( - signature_def_utils_impl.get_signature_def_input_shapes(signature_def), - {"input-1": [2], "input-2": [10, 11]}) - self.assertEqual( - signature_def_utils_impl.get_signature_def_output_shapes(signature_def), - {"output-1": [10, 32], "output-2": [1, 1]}) - self.assertEqual( - signature_def_utils_impl.get_signature_def_input_types(signature_def), - {"input-1": dtypes.string, "input-2": dtypes.float32}) - self.assertEqual( - signature_def_utils_impl.get_signature_def_output_types(signature_def), - {"output-1": dtypes.float32, "output-2": dtypes.string}) - - def testGetNonFullySpecifiedShapes(self): - outputs = { - "output-1": array_ops.placeholder(dtypes.float32, [None, 10, None]), - "output-2": array_ops.sparse_placeholder(dtypes.float32), - } - signature_def = _make_signature({}, outputs) - shapes = signature_def_utils_impl.get_signature_def_output_shapes( - signature_def) - self.assertEqual(len(shapes), 2) - # Must compare shapes with as_list() since 2 equivalent non-fully defined - # shapes are not equal to each other. - self.assertEqual(shapes["output-1"].as_list(), [None, 10, None]) - # Must compare `dims` since its an unknown shape. - self.assertEqual(shapes["output-2"].dims, None) - def _assertValidSignature(self, inputs, outputs, method_name): signature_def = signature_def_utils_impl.build_signature_def( inputs, outputs, method_name) |