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_FOLD_CONSTANTS_LIB_H_ 17 #define TENSORFLOW_TOOLS_GRAPH_TRANSFORMS_FOLD_CONSTANTS_LIB_H_ 18 19 #include "tensorflow/core/framework/graph.pb.h" 20 #include "tensorflow/core/lib/core/status.h" 21 #include "tensorflow/tools/graph_transforms/transform_utils.h" 22 23 namespace tensorflow { 24 namespace graph_transforms { 25 26 // Finds sub-graphs that evaluate to constant expressions, and replaces them 27 // with Const nodes, to simplify the graph. The inputs and outputs arguments are 28 // the names of all the nodes that data is fed into, or read out of, when the 29 // graph is actually run. 30 Status FoldConstants(const GraphDef& input_graph_def, 31 const TransformFuncContext& context, 32 GraphDef* output_graph_def); 33 34 // Analyzes which nodes are used for the given set of inputs and outputs, and 35 // returns a copy of the graph with any that aren't used removed. 36 Status RemoveUnusedNodes(const GraphDef& input_graph_def, 37 const TransformFuncContext& context, 38 GraphDef* output_graph_def); 39 40 } // namespace graph_transforms 41 } // namespace tensorflow 42 43 #endif // TENSORFLOW_TOOLS_GRAPH_TRANSFORMS_FOLD_CONSTANTS_LIB_H_ 44