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

Method Build

tensorflow/core/profiler/internal/tfprof_graph.cc:45–70  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

43}
44
45void TFGraph::Build() {
46 if (root_) return;
47
48 std::set<string> nonroots;
49 // Filter out the root nodes (node not input of any other node).
50 for (auto it = nodes_map_.begin(); it != nodes_map_.end(); it++) {
51 GraphNode* node = it->second.get();
52 const std::map<int, string>& inputs = node->node->inputs();
53 for (auto inputs_it = inputs.cbegin(); inputs_it != inputs.cend();
54 inputs_it++) {
55 nonroots.insert(inputs_it->second);
56 auto child_it = nodes_map_.find(inputs_it->second);
57 if (child_it != nodes_map_.end()) {
58 node->children.push_back(child_it->second.get());
59 }
60 }
61 }
62 std::vector<GraphNode*> roots;
63 for (auto it = nodes_map_.begin(); it != nodes_map_.end(); it++) {
64 if (nonroots.find(it->first) == nonroots.end()) {
65 roots.push_back(it->second.get());
66 }
67 }
68 root_ = CreateParentNode(kTFProfRoot);
69 root_->children.insert(root_->children.end(), roots.begin(), roots.end());
70}
71
72const ShowNode* TFGraph::ShowInternal(const Options& opts, Timeline* timeline) {
73 root_->ResetTotalStats();

Callers

nothing calls this directly

Calls 7

beginMethod · 0.45
endMethod · 0.45
getMethod · 0.45
inputsMethod · 0.45
insertMethod · 0.45
findMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected