1 | /* Copyright 2017 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_PYTHON_GRAPPLER_MODEL_ANALYZER_H_ |
17 | #define TENSORFLOW_PYTHON_GRAPPLER_MODEL_ANALYZER_H_ |
18 | |
19 | #include <iostream> |
20 | #include "tensorflow/core/framework/node_def.pb.h" |
21 | #include "tensorflow/core/lib/core/status.h" |
22 | |
23 | namespace tensorflow { |
24 | |
25 | namespace grappler { |
26 | struct GrapplerItem; |
27 | class GraphProperties; |
28 | |
29 | // Generate a report detailing how much information is known statically for most |
30 | // operations in the model, including output data types and output shapes. |
31 | class ModelAnalyzer { |
32 | public: |
33 | explicit ModelAnalyzer(const GrapplerItem& item); |
34 | Status GenerateReport(bool debug, bool assume_valid_feeds, std::ostream& os); |
35 | |
36 | private: |
37 | void PrintNodeInfo(const NodeDef* node, const GraphProperties& properties, |
38 | bool debug, std::ostream& os) const; |
39 | |
40 | const GrapplerItem& item_; |
41 | }; |
42 | |
43 | } // end namespace grappler |
44 | } // end namespace tensorflow |
45 | |
46 | #endif // TENSORFLOW_PYTHON_GRAPPLER_MODEL_ANALYZER_H_ |
47 | |