Immutable GraphView that keeps the constness of the GraphDef. If you need to mutate the graph or the nodes via the graph view lookup functions, see MutableGraphView.
| 398 | // mutate the graph or the nodes via the graph view lookup functions, see |
| 399 | // MutableGraphView. |
| 400 | class GraphView |
| 401 | : public internal::GraphViewInternal<const GraphDef, const NodeDef> { |
| 402 | public: |
| 403 | explicit GraphView(const GraphDef* graph) : GraphViewInternal(graph) { |
| 404 | for (const NodeDef& node : graph->node()) AddUniqueNodeOrDie(&node); |
| 405 | for (const NodeDef& node : graph->node()) AddFanouts(&node); |
| 406 | } |
| 407 | }; |
| 408 | |
| 409 | // Returns true if node has one (or zero) fanout nodes at given output port. |
| 410 | bool HasSingleFanoutNode(const GraphView& graph_view, const NodeDef* node, |