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"""Signature constants for SavedModel save and restore operations. 16 17""" 18from tensorflow.python.util.tf_export import tf_export 19 20 21# Key in the signature def map for `default` serving signatures. The default 22# signature is used in inference requests where a specific signature was not 23# specified. 24DEFAULT_SERVING_SIGNATURE_DEF_KEY = "serving_default" 25tf_export( 26 "saved_model.DEFAULT_SERVING_SIGNATURE_DEF_KEY", 27 v1=[ 28 "saved_model.DEFAULT_SERVING_SIGNATURE_DEF_KEY", 29 "saved_model.signature_constants.DEFAULT_SERVING_SIGNATURE_DEF_KEY" 30 ], 31).export_constant(__name__, "DEFAULT_SERVING_SIGNATURE_DEF_KEY") 32 33################################################################################ 34# Classification API constants. 35 36# Classification inputs. 37CLASSIFY_INPUTS = "inputs" 38tf_export( 39 "saved_model.CLASSIFY_INPUTS", 40 v1=[ 41 "saved_model.CLASSIFY_INPUTS", 42 "saved_model.signature_constants.CLASSIFY_INPUTS" 43 ]).export_constant(__name__, "CLASSIFY_INPUTS") 44 45# Classification method name used in a SignatureDef. 46CLASSIFY_METHOD_NAME = "tensorflow/serving/classify" 47tf_export( 48 "saved_model.CLASSIFY_METHOD_NAME", 49 v1=[ 50 "saved_model.CLASSIFY_METHOD_NAME", 51 "saved_model.signature_constants.CLASSIFY_METHOD_NAME" 52 ]).export_constant(__name__, "CLASSIFY_METHOD_NAME") 53 54# Classification classes output. 55CLASSIFY_OUTPUT_CLASSES = "classes" 56tf_export( 57 "saved_model.CLASSIFY_OUTPUT_CLASSES", 58 v1=[ 59 "saved_model.CLASSIFY_OUTPUT_CLASSES", 60 "saved_model.signature_constants.CLASSIFY_OUTPUT_CLASSES" 61 ]).export_constant(__name__, "CLASSIFY_OUTPUT_CLASSES") 62 63# Classification scores output. 64CLASSIFY_OUTPUT_SCORES = "scores" 65tf_export( 66 "saved_model.CLASSIFY_OUTPUT_SCORES", 67 v1=[ 68 "saved_model.CLASSIFY_OUTPUT_SCORES", 69 "saved_model.signature_constants.CLASSIFY_OUTPUT_SCORES" 70 ]).export_constant(__name__, "CLASSIFY_OUTPUT_SCORES") 71 72################################################################################ 73# Prediction API constants. 74 75# Predict inputs. 76PREDICT_INPUTS = "inputs" 77tf_export( 78 "saved_model.PREDICT_INPUTS", 79 v1=[ 80 "saved_model.PREDICT_INPUTS", 81 "saved_model.signature_constants.PREDICT_INPUTS" 82 ]).export_constant(__name__, "PREDICT_INPUTS") 83 84# Prediction method name used in a SignatureDef. 85PREDICT_METHOD_NAME = "tensorflow/serving/predict" 86tf_export( 87 "saved_model.PREDICT_METHOD_NAME", 88 v1=[ 89 "saved_model.PREDICT_METHOD_NAME", 90 "saved_model.signature_constants.PREDICT_METHOD_NAME" 91 ]).export_constant(__name__, "PREDICT_METHOD_NAME") 92 93# Predict outputs. 94PREDICT_OUTPUTS = "outputs" 95tf_export( 96 "saved_model.PREDICT_OUTPUTS", 97 v1=[ 98 "saved_model.PREDICT_OUTPUTS", 99 "saved_model.signature_constants.PREDICT_OUTPUTS" 100 ]).export_constant(__name__, "PREDICT_OUTPUTS") 101 102################################################################################ 103# Regression API constants. 104 105# Regression inputs. 106REGRESS_INPUTS = "inputs" 107tf_export( 108 "saved_model.REGRESS_INPUTS", 109 v1=[ 110 "saved_model.REGRESS_INPUTS", 111 "saved_model.signature_constants.REGRESS_INPUTS" 112 ]).export_constant(__name__, "REGRESS_INPUTS") 113 114# Regression method name used in a SignatureDef. 115REGRESS_METHOD_NAME = "tensorflow/serving/regress" 116tf_export( 117 "saved_model.REGRESS_METHOD_NAME", 118 v1=[ 119 "saved_model.REGRESS_METHOD_NAME", 120 "saved_model.signature_constants.REGRESS_METHOD_NAME" 121 ]).export_constant(__name__, "REGRESS_METHOD_NAME") 122 123# Regression outputs. 124REGRESS_OUTPUTS = "outputs" 125tf_export( 126 "saved_model.REGRESS_OUTPUTS", 127 v1=[ 128 "saved_model.REGRESS_OUTPUTS", 129 "saved_model.signature_constants.REGRESS_OUTPUTS" 130 ]).export_constant(__name__, "REGRESS_OUTPUTS") 131 132################################################################################ 133# LINT.IfChange 134# Train/Eval API constants. 135# Not exported while export_all_saved_models is experimental. 136DEFAULT_TRAIN_SIGNATURE_DEF_KEY = "train" 137 138DEFAULT_EVAL_SIGNATURE_DEF_KEY = "eval" 139 140SUPERVISED_TRAIN_METHOD_NAME = "tensorflow/supervised/training" 141 142SUPERVISED_EVAL_METHOD_NAME = "tensorflow/supervised/eval" 143# LINT.ThenChange(//tensorflow/python/keras/saving/utils_v1/unexported_constants.py) 144