diff options
-rw-r--r-- | tensorflow/contrib/saved_model/BUILD | 16 | ||||
-rw-r--r-- | tensorflow/python/saved_model/BUILD | 34 | ||||
-rw-r--r-- | tensorflow/python/saved_model/saved_model.py | 4 | ||||
-rw-r--r-- | tensorflow/python/saved_model/simple_save.py (renamed from tensorflow/contrib/saved_model/python/saved_model/utils.py) | 4 | ||||
-rw-r--r-- | tensorflow/python/saved_model/simple_save_test.py (renamed from tensorflow/contrib/saved_model/python/saved_model/utils_test.py) | 8 | ||||
-rw-r--r-- | tensorflow/tools/api/golden/tensorflow.saved_model.pbtxt | 4 |
6 files changed, 48 insertions, 22 deletions
diff --git a/tensorflow/contrib/saved_model/BUILD b/tensorflow/contrib/saved_model/BUILD index 20be819e07..245fe07f2b 100644 --- a/tensorflow/contrib/saved_model/BUILD +++ b/tensorflow/contrib/saved_model/BUILD @@ -82,22 +82,6 @@ py_test( ], ) -py_test( - name = "utils_test", - size = "small", - srcs = ["python/saved_model/utils_test.py"], - srcs_version = "PY2AND3", - deps = [ - ":saved_model_py", - "//tensorflow/python:client_testlib", - "//tensorflow/python:framework_ops", - "//tensorflow/python:variables", - "//tensorflow/python/saved_model:loader", - "//tensorflow/python/saved_model:signature_constants", - "//tensorflow/python/saved_model:tag_constants", - ], -) - filegroup( name = "all_files", srcs = glob( diff --git a/tensorflow/python/saved_model/BUILD b/tensorflow/python/saved_model/BUILD index 39c6439811..e34aa7cc2c 100644 --- a/tensorflow/python/saved_model/BUILD +++ b/tensorflow/python/saved_model/BUILD @@ -25,6 +25,7 @@ py_library( ":main_op", ":signature_constants", ":signature_def_utils", + ":simple_save", ":tag_constants", ":utils", "//tensorflow/python:util", @@ -90,6 +91,23 @@ py_library( ) py_library( + name = "simple_save", + srcs = [ + "simple_save.py", + ], + srcs_version = "PY2AND3", + deps = [ + ":builder", + ":signature_constants", + ":signature_def_utils", + ":tag_constants", + "//tensorflow/core:protos_all_py", + "//tensorflow/python:lib", + "//tensorflow/python:util", + ], +) + +py_library( name = "main_op", srcs = [ "main_op.py", @@ -198,6 +216,22 @@ py_test( ], ) +py_test( + name = "simple_save_test", + size = "small", + srcs = ["simple_save_test.py"], + srcs_version = "PY2AND3", + deps = [ + ":loader", + ":signature_constants", + ":simple_save", + ":tag_constants", + "//tensorflow/python:client_testlib", + "//tensorflow/python:framework_ops", + "//tensorflow/python:variables", + ], +) + # ----------------------------------------------------------------------------- # Google-internal targets. These must be at the end for syncrepo. diff --git a/tensorflow/python/saved_model/saved_model.py b/tensorflow/python/saved_model/saved_model.py index 8c59f7afe7..caabd7bc30 100644 --- a/tensorflow/python/saved_model/saved_model.py +++ b/tensorflow/python/saved_model/saved_model.py @@ -30,6 +30,9 @@ from tensorflow.python.saved_model import signature_def_utils from tensorflow.python.saved_model import tag_constants from tensorflow.python.saved_model import utils # pylint: enable=unused-import +# pylint: disable=wildcard-import +from tensorflow.python.saved_model.simple_save import * +# pylint: enable=wildcard-import from tensorflow.python.util.all_util import remove_undocumented @@ -41,6 +44,7 @@ _allowed_symbols = [ "main_op", "signature_constants", "signature_def_utils", + "simple_save", "tag_constants", "utils", ] diff --git a/tensorflow/contrib/saved_model/python/saved_model/utils.py b/tensorflow/python/saved_model/simple_save.py index 9f34af64a6..9a81e5cd80 100644 --- a/tensorflow/contrib/saved_model/python/saved_model/utils.py +++ b/tensorflow/python/saved_model/simple_save.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # ============================================================================== -"""SavedModel utility functions.""" +"""SavedModel simple save functionality.""" from __future__ import absolute_import from __future__ import division @@ -39,7 +39,7 @@ def simple_save(session, export_dir, inputs, outputs, legacy_init_op=None): to configure a SavedModel, this method has a few practical implications: - It will be treated as a graph for inference / serving (i.e. uses the tag `tag_constants.SERVING`) - - The saved model will load in TensorFlow Serving and supports the + - The SavedModel will load in TensorFlow Serving and supports the [Predict API](https://github.com/tensorflow/serving/blob/master/tensorflow_serving/apis/predict.proto). To use the Classify, Regress, or MultiInference APIs, please use either diff --git a/tensorflow/contrib/saved_model/python/saved_model/utils_test.py b/tensorflow/python/saved_model/simple_save_test.py index 36dfb88871..b2fa40d4f1 100644 --- a/tensorflow/contrib/saved_model/python/saved_model/utils_test.py +++ b/tensorflow/python/saved_model/simple_save_test.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # ============================================================================== -"""Tests for saved_model utils.""" +"""Tests for SavedModel simple save functionality.""" from __future__ import absolute_import from __future__ import division @@ -20,16 +20,16 @@ from __future__ import print_function import os -from tensorflow.contrib.saved_model.python.saved_model import utils from tensorflow.python.framework import ops from tensorflow.python.ops import variables from tensorflow.python.platform import test from tensorflow.python.saved_model import loader from tensorflow.python.saved_model import signature_constants +from tensorflow.python.saved_model import simple_save from tensorflow.python.saved_model import tag_constants -class UtilsTest(test.TestCase): +class SimpleSaveTest(test.TestCase): def _init_and_validate_variable(self, sess, variable_name, variable_value): v = variables.Variable(variable_value, name=variable_name) @@ -65,7 +65,7 @@ class UtilsTest(test.TestCase): var_y = self._init_and_validate_variable(sess, "var_y", 2) inputs = {"x": var_x} outputs = {"y": var_y} - utils.simple_save(sess, export_dir, inputs, outputs) + simple_save.simple_save(sess, export_dir, inputs, outputs) # Restore the graph with a valid tag and check the global variables and # signature def map. diff --git a/tensorflow/tools/api/golden/tensorflow.saved_model.pbtxt b/tensorflow/tools/api/golden/tensorflow.saved_model.pbtxt index 5683766b28..e1a0385092 100644 --- a/tensorflow/tools/api/golden/tensorflow.saved_model.pbtxt +++ b/tensorflow/tools/api/golden/tensorflow.saved_model.pbtxt @@ -32,4 +32,8 @@ tf_module { name: "utils" mtype: "<type \'module\'>" } + member_method { + name: "simple_save" + argspec: "args=[\'session\', \'export_dir\', \'inputs\', \'outputs\', \'legacy_init_op\'], varargs=None, keywords=None, defaults=[\'None\'], " + } } |