1 /* Copyright 2021 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 // Defines the pywrap_saved_model module. In order to have only one dynamically- 17 // linked shared object, all SavedModel python bindings should be added here. 18 19 #include "pybind11/pybind11.h" 20 #include "tensorflow/cc/experimental/libexport/save.h" 21 #include "tensorflow/python/lib/core/pybind11_status.h" 22 #include "tensorflow/python/saved_model/pywrap_saved_model_constants.h" 23 #include "tensorflow/python/saved_model/pywrap_saved_model_fingerprinting.h" 24 #include "tensorflow/python/saved_model/pywrap_saved_model_metrics.h" 25 26 namespace tensorflow { 27 namespace saved_model { 28 namespace python { 29 PYBIND11_MODULE(pywrap_saved_model,m)30PYBIND11_MODULE(pywrap_saved_model, m) { 31 m.doc() = "TensorFlow SavedModel Python bindings"; 32 33 m.def("Save", [](const char* export_dir) { 34 MaybeRaiseFromStatus(libexport::Save(export_dir)); 35 }); 36 37 DefineConstantsModule(m); 38 DefineMetricsModule(m); 39 DefineFingerprintingModule(m); 40 } 41 42 } // namespace python 43 } // namespace saved_model 44 } // namespace tensorflow 45