MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / GraphView

Method GraphView

tensorflow/core/grappler/utils/graph_view.cc:84–108  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

82} // namespace
83
84GraphView::GraphView(const GraphDef* graph, Status* status)
85 : GraphViewInternal(graph) {
86 const int num_nodes = graph->node_size();
87 node_index_by_name_.reserve(num_nodes);
88 nodes_.reserve(num_nodes);
89 for (const NodeDef& node : graph->node()) {
90 if (!AddUniqueNodeInternal(&node)) {
91 *status = errors::InvalidArgument(
92 kGraphViewError, "graph has multiple nodes with the name '",
93 node.name(), "'.");
94 Reset();
95 return;
96 }
97 }
98 Status s;
99 for (NodeView& node_view : nodes_) {
100 s = CheckAndAddFaninsInternal(&node_view);
101 if (!s.ok()) {
102 *status = s;
103 Reset();
104 return;
105 }
106 }
107 *status = Status::OK();
108}
109
110bool GraphView::AddUniqueNodeInternal(const NodeDef* node) {
111 const int node_index = node_index_by_name_.size();

Callers

nothing calls this directly

Calls 6

InvalidArgumentFunction · 0.85
ResetFunction · 0.70
nameMethod · 0.65
reserveMethod · 0.45
nodeMethod · 0.45
okMethod · 0.45

Tested by

no test coverage detected