1 | /* Copyright 2018 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 | /// Functions to read the SavedModel proto, or parts of it. |
17 | |
18 | #ifndef TENSORFLOW_CC_SAVED_MODEL_READER_H_ |
19 | #define TENSORFLOW_CC_SAVED_MODEL_READER_H_ |
20 | |
21 | #include <string> |
22 | #include <unordered_set> |
23 | |
24 | #include "tensorflow/core/lib/core/status.h" |
25 | #include "tensorflow/core/protobuf/graph_debug_info.pb.h" |
26 | #include "tensorflow/core/protobuf/meta_graph.pb.h" |
27 | |
28 | namespace tensorflow { |
29 | // Reads the SavedModel proto from saved_model.pb(txt) in the given directory, |
30 | // finds the MetaGraphDef that matches the given set of tags and writes it to |
31 | // the `meta_graph_def` parameter. Returns a failure status when the SavedModel |
32 | // file does not exist or no MetaGraphDef matches the tags. |
33 | Status ReadMetaGraphDefFromSavedModel(const string& export_dir, |
34 | const std::unordered_set<string>& tags, |
35 | MetaGraphDef* const meta_graph_def); |
36 | |
37 | // Store debug info from the SavedModel export dir. |
38 | Status ReadSavedModelDebugInfoIfPresent( |
39 | const string& export_dir, |
40 | std::unique_ptr<GraphDebugInfo>* debug_info_proto); |
41 | |
42 | } // namespace tensorflow |
43 | |
44 | #endif // TENSORFLOW_CC_SAVED_MODEL_READER_H_ |
45 | |