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

Function InsertNode

tensorflow/lite/toco/dump_graphviz.cc:679–698  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

677}
678
679void InsertNode(const Model& model, const string& array_id, Node* node,
680 std::vector<string> prefixes, int64* math_ops) {
681 if (prefixes.empty()) {
682 // Base case: store array in this node.
683 node->array_id = array_id;
684 *math_ops = GetArithmeticOpsCount(model, array_id);
685 } else {
686 // Insert into the sub-tree for that prefix.
687 string prefix = prefixes.back();
688 prefixes.pop_back();
689 if (node->children.count(prefix) == 0) {
690 // Create a new node if this prefix is unseen.
691 node->children[prefix] = absl::make_unique<Node>();
692 }
693 InsertNode(model, array_id, node->children[prefix].get(), prefixes,
694 math_ops);
695 }
696 // Sum estimated math ops into all nodes.
697 node->math_ops += *math_ops;
698}
699
700void BuildArrayTree(const Model& model, Node* tree) {
701 // Delimit array names by path "/", then place into a tree based on this path.

Callers 1

BuildArrayTreeFunction · 0.85

Calls 6

GetArithmeticOpsCountFunction · 0.85
pop_backMethod · 0.80
emptyMethod · 0.45
backMethod · 0.45
countMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected