• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#     http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14# ==============================================================================
15"""Constants for SavedModel save and restore operations.
16
17The source of truth for these constants is in
18tensorflow/cc/saved_model/constants.h.
19
20"""
21from tensorflow.python.saved_model.pywrap_saved_model import constants
22from tensorflow.python.util.tf_export import tf_export
23
24# Subdirectory name containing the asset files.
25ASSETS_DIRECTORY = constants.ASSETS_DIRECTORY
26tf_export(
27    "saved_model.ASSETS_DIRECTORY",
28    v1=[
29        "saved_model.ASSETS_DIRECTORY", "saved_model.constants.ASSETS_DIRECTORY"
30    ]).export_constant(__name__, "ASSETS_DIRECTORY")
31
32# Subdirectory name containing unmanaged files from higher-level APIs.
33EXTRA_ASSETS_DIRECTORY = constants.EXTRA_ASSETS_DIRECTORY
34
35# CollectionDef key containing SavedModel assets.
36ASSETS_KEY = constants.ASSETS_KEY
37tf_export(
38    "saved_model.ASSETS_KEY",
39    v1=["saved_model.ASSETS_KEY",
40        "saved_model.constants.ASSETS_KEY"]).export_constant(
41            __name__, "ASSETS_KEY")
42
43# CollectionDef key for the legacy init op.
44LEGACY_INIT_OP_KEY = constants.LEGACY_INIT_OP_KEY
45tf_export(
46    v1=[
47        "saved_model.LEGACY_INIT_OP_KEY",
48        "saved_model.constants.LEGACY_INIT_OP_KEY"
49    ]).export_constant(__name__, "LEGACY_INIT_OP_KEY")
50
51# CollectionDef key for the SavedModel main op.
52MAIN_OP_KEY = constants.MAIN_OP_KEY
53tf_export(
54    v1=["saved_model.MAIN_OP_KEY",
55        "saved_model.constants.MAIN_OP_KEY"]).export_constant(
56            __name__, "MAIN_OP_KEY")
57
58# CollectionDef key for the SavedModel train op.
59# Not exported while export_all_saved_models is experimental.
60TRAIN_OP_KEY = constants.TRAIN_OP_KEY
61
62# Schema version for SavedModel.
63SAVED_MODEL_SCHEMA_VERSION = constants.SAVED_MODEL_SCHEMA_VERSION
64tf_export(
65    "saved_model.SAVED_MODEL_SCHEMA_VERSION",
66    v1=[
67        "saved_model.SAVED_MODEL_SCHEMA_VERSION",
68        "saved_model.constants.SAVED_MODEL_SCHEMA_VERSION"
69    ]).export_constant(__name__, "SAVED_MODEL_SCHEMA_VERSION")
70
71# File name for SavedModel protocol buffer.
72SAVED_MODEL_FILENAME_PB = constants.SAVED_MODEL_FILENAME_PB
73tf_export(
74    "saved_model.SAVED_MODEL_FILENAME_PB",
75    v1=[
76        "saved_model.SAVED_MODEL_FILENAME_PB",
77        "saved_model.constants.SAVED_MODEL_FILENAME_PB"
78    ]).export_constant(__name__, "SAVED_MODEL_FILENAME_PB")
79
80# File name for text version of SavedModel protocol buffer.
81SAVED_MODEL_FILENAME_PBTXT = constants.SAVED_MODEL_FILENAME_PBTXT
82tf_export(
83    "saved_model.SAVED_MODEL_FILENAME_PBTXT",
84    v1=[
85        "saved_model.SAVED_MODEL_FILENAME_PBTXT",
86        "saved_model.constants.SAVED_MODEL_FILENAME_PBTXT"
87    ]).export_constant(__name__, "SAVED_MODEL_FILENAME_PBTXT")
88
89# Subdirectory where debugging related files are written.
90DEBUG_DIRECTORY = constants.DEBUG_DIRECTORY
91tf_export(
92    "saved_model.DEBUG_DIRECTORY",
93    v1=[
94        "saved_model.DEBUG_DIRECTORY",
95        "saved_model.constants.DEBUG_DIRECTORY",
96    ]).export_constant(__name__, "DEBUG_DIRECTORY")
97
98# File name for GraphDebugInfo protocol buffer which corresponds to the
99# SavedModel.
100DEBUG_INFO_FILENAME_PB = constants.DEBUG_INFO_FILENAME_PB
101tf_export(
102    "saved_model.DEBUG_INFO_FILENAME_PB",
103    v1=[
104        "saved_model.DEBUG_INFO_FILENAME_PB",
105        "saved_model.constants.DEBUG_INFO_FILENAME_PB"
106    ]).export_constant(__name__, "DEBUG_INFO_FILENAME_PB")
107
108# Subdirectory name containing the variables/checkpoint files.
109VARIABLES_DIRECTORY = constants.VARIABLES_DIRECTORY
110tf_export(
111    "saved_model.VARIABLES_DIRECTORY",
112    v1=[
113        "saved_model.VARIABLES_DIRECTORY",
114        "saved_model.constants.VARIABLES_DIRECTORY"
115    ]).export_constant(__name__, "VARIABLES_DIRECTORY")
116
117# File name used for variables.
118VARIABLES_FILENAME = constants.VARIABLES_FILENAME
119tf_export(
120    "saved_model.VARIABLES_FILENAME",
121    v1=[
122        "saved_model.VARIABLES_FILENAME",
123        "saved_model.constants.VARIABLES_FILENAME"
124    ]).export_constant(__name__, "VARIABLES_FILENAME")
125
126# The initialization and train ops for a MetaGraph are stored in the
127# signature def map. The ops are added to the map with the following keys.
128INIT_OP_SIGNATURE_KEY = constants.INIT_OP_SIGNATURE_KEY
129TRAIN_OP_SIGNATURE_KEY = constants.TRAIN_OP_SIGNATURE_KEY
130