1 /* Copyright 2020 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 16 #ifndef TENSORFLOW_C_EXPERIMENTAL_SAVED_MODEL_PUBLIC_SIGNATURE_DEF_FUNCTION_H_ 17 #define TENSORFLOW_C_EXPERIMENTAL_SAVED_MODEL_PUBLIC_SIGNATURE_DEF_FUNCTION_H_ 18 19 #include "tensorflow/c/c_api_macros.h" 20 #include "tensorflow/c/eager/c_api.h" 21 #include "tensorflow/c/experimental/saved_model/public/signature_def_function_metadata.h" 22 23 #ifdef __cplusplus 24 extern "C" { 25 #endif // __cplusplus 26 27 // An opaque type that corresponds to a SignatureDefFunction loaded from a 28 // SavedModel. 29 typedef struct TF_SignatureDefFunction TF_SignatureDefFunction; 30 31 // Returns FunctionMetadata associated with `func`. Metadata's lifetime is 32 // bound to `func`, which is bound to the TF_SavedModel it was loaded from. 33 TF_CAPI_EXPORT extern TF_SignatureDefFunctionMetadata* 34 TF_SignatureDefFunctionGetMetadata(TF_SignatureDefFunction* func); 35 36 // Returns a TFE_Op suitable for executing this function. Caller must provide 37 // all function inputs in `inputs`, and must not add any additional inputs on 38 // the returned op. (i.e. don't call TFE_OpAddInput or TFE_OpAddInputList). 39 // The caller is responsible for deleting the returned TFE_Op. If op 40 // construction fails, `status` will be non-OK and the returned pointer will be 41 // null. 42 TF_CAPI_EXPORT extern TFE_Op* TF_SignatureDefFunctionMakeCallOp( 43 TF_SignatureDefFunction* func, TFE_TensorHandle** inputs, int num_inputs, 44 TF_Status* status); 45 46 #ifdef __cplusplus 47 } // end extern "C" 48 #endif // __cplusplus 49 50 #endif // TENSORFLOW_C_EXPERIMENTAL_SAVED_MODEL_PUBLIC_SIGNATURE_DEF_FUNCTION_H_ 51