| 211 | } |
| 212 | |
| 213 | std::vector<GraphNode*> TFGraph::Account(const std::vector<GraphNode*>& roots, |
| 214 | const Options& opts, |
| 215 | std::set<string>* visits) { |
| 216 | std::vector<GraphNode*> act_nodes; |
| 217 | for (GraphNode* node : roots) { |
| 218 | if (visits->find(node->name()) != visits->end()) continue; |
| 219 | visits->insert(node->name()); |
| 220 | // Depth-first. |
| 221 | std::vector<GraphNode*> act_cnodes = Account(node->children, opts, visits); |
| 222 | |
| 223 | node->account = ReAccount(node, opts); |
| 224 | if (node->account) { |
| 225 | node->show_children.clear(); |
| 226 | node->ResetTotalStats(); |
| 227 | node->AddSelfToTotalStats(); |
| 228 | // Aggregate its accounted children stats. |
| 229 | for (GraphNode* c : act_cnodes) { |
| 230 | node->AggregateTotalStats(c); |
| 231 | node->show_children.push_back(c); |
| 232 | } |
| 233 | act_nodes.push_back(node); |
| 234 | } else { |
| 235 | // If the current node is not accounted, pass the children to the |
| 236 | // ancestor. |
| 237 | act_nodes.insert(act_nodes.end(), act_cnodes.begin(), act_cnodes.end()); |
| 238 | } |
| 239 | } |
| 240 | return act_nodes; |
| 241 | } |
| 242 | } // namespace tfprof |
| 243 | } // namespace tensorflow |
nothing calls this directly
no test coverage detected