| 57 | } |
| 58 | |
| 59 | bool OptimizerFusionImpl::VisitMatchedNodes() { |
| 60 | bool all_visited = false; |
| 61 | while (!all_visited) { |
| 62 | all_visited = true; |
| 63 | for (auto iter = matched_node_map_.begin(); |
| 64 | iter != matched_node_map_.end(); ++iter) { |
| 65 | if (iter->second.visited) { |
| 66 | continue; |
| 67 | } |
| 68 | all_visited = false; |
| 69 | // check dynamic inputs |
| 70 | auto search_itr = |
| 71 | t_->nodes_dynamic_iedges_.find(temp_node_map_[iter->first].key); |
| 72 | if (search_itr != t_->nodes_dynamic_iedges_.end()) { |
| 73 | // inputs of this node is marked as dynamic |
| 74 | if (!t_->CheckDynamicInputs(iter->second.node, |
| 75 | &temp_node_map_[iter->first], search_itr->second, |
| 76 | fused_op_inputs_, temp_node_map_, matched_node_map_)) { |
| 77 | return false; |
| 78 | } |
| 79 | } else { |
| 80 | // standard input checking |
| 81 | if (!CheckInputs(iter->second.node, &temp_node_map_[iter->first])) { |
| 82 | return false; |
| 83 | } |
| 84 | } |
| 85 | // check dynamic outputs |
| 86 | search_itr = |
| 87 | t_->nodes_dynamic_oedges_.find(temp_node_map_[iter->first].key); |
| 88 | if (search_itr != t_->nodes_dynamic_oedges_.end()) { |
| 89 | // outputs of this node is marked as dynamic |
| 90 | if (!t_->CheckDynamicOutputs(iter->second.node, |
| 91 | &temp_node_map_[iter->first], search_itr->second, |
| 92 | fused_op_outputs_, temp_node_map_, matched_node_map_)) { |
| 93 | return false; |
| 94 | } |
| 95 | } else { |
| 96 | // standard output checking |
| 97 | if (!CheckOutputs(iter->second.node, &temp_node_map_[iter->first])) { |
| 98 | return false; |
| 99 | } |
| 100 | } |
| 101 | iter->second.visited = true; |
| 102 | } |
| 103 | } |
| 104 | return true; |
| 105 | } |
| 106 | bool OptimizerFusionImpl::CheckOutputs(const Node* node, |
| 107 | const TempNode* temp_node) { |
| 108 | std::map<int, std::vector<const Edge*>> oedge_map; |
nothing calls this directly
no test coverage detected