1 | /* Copyright 2015 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_TOOLS_GRAPH_TRANSFORMS_TRANSFORM_GRAPH_H_ |
17 | #define TENSORFLOW_TOOLS_GRAPH_TRANSFORMS_TRANSFORM_GRAPH_H_ |
18 | |
19 | #include <vector> |
20 | |
21 | #include "tensorflow/core/framework/graph.pb.h" |
22 | #include "tensorflow/core/lib/core/status.h" |
23 | #include "tensorflow/tools/graph_transforms/transform_utils.h" |
24 | |
25 | namespace tensorflow { |
26 | namespace graph_transforms { |
27 | |
28 | // Convenience function to handle argument parsing for the command line tool. |
29 | // If init_main is false, we're testing so don't call core initialization. |
30 | int ParseFlagsAndTransformGraph(int argc, char* argv[], bool init_main); |
31 | |
32 | // Handles converting the transforms string into transform names and their |
33 | // arguments. |
34 | typedef std::vector<std::pair<string, TransformFuncParameters>> |
35 | TransformParameters; |
36 | Status ParseTransformParameters(const string& transforms_string, |
37 | TransformParameters* params_list); |
38 | |
39 | // Applies a series of transformations to the GraphDef. These transforms are |
40 | // defined by modules that call REGISTER_GRAPH_TRANSFORM() to associate a |
41 | // function with a name string. |
42 | Status TransformGraph(const std::vector<string>& inputs, |
43 | const std::vector<string>& outputs, |
44 | const TransformParameters& transform_params, |
45 | GraphDef* graph_def); |
46 | |
47 | } // namespace graph_transforms |
48 | } // namespace tensorflow |
49 | |
50 | #endif // TENSORFLOW_TOOLS_GRAPH_TRANSFORMS_TRANSFORM_GRAPH_H_ |
51 | |