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

Method NodeMap

tensorflow/core/grappler/utils.cc:75–91  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

73} // namespace
74
75NodeMap::NodeMap(GraphDef* graph) {
76 CHECK(graph != nullptr);
77 for (int i = 0; i < graph->node_size(); i++) {
78 NodeDef* node = graph->mutable_node(i);
79 const string& node_name = node->name();
80 auto rslt = nodes_.emplace(node_name, node);
81 // Check that the graph doesn't contain multiple nodes with the same name.
82 if (!rslt.second) {
83 // The first node found with a given name becomes the canonical.
84 LOG(WARNING) << "Duplicated node in the graph: " << node_name;
85 }
86 NodeDef* canonical = rslt.second ? node : rslt.first->second;
87 for (const auto& input : node->input()) {
88 outputs_[NodeName(input)].insert(canonical);
89 }
90 }
91}
92
93void NodeMap::RemoveNode(const string& name) {
94 nodes_.erase(NodeName(name));

Callers

nothing calls this directly

Calls 5

NodeNameFunction · 0.85
nameMethod · 0.65
emplaceMethod · 0.45
inputMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected