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

Method GetMatchedNodes

tensorflow/core/grappler/utils/pattern_utils.cc:101–123  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

99// Current implementation supports pattern maching toward node's inputs only.
100template <>
101bool SubGraphMatcher<MatchingDirection::kFollowInputs>::GetMatchedNodes(
102 const OpTypePattern& pattern, MutableNodeView* node_view,
103 std::map<string, int>* matched_nodes_map,
104 std::set<int>* remove_node_indices) {
105 bool found_match = false;
106 match_.reset(new NodeViewMatch());
107 if (DoesOpTypePatternMatch(pattern, node_view, match_.get())) {
108 if (!HasRemoveNodeExternalDependents()) {
109 found_match = true;
110 matched_nodes_map->swap(this->node_label_to_index_);
111 remove_node_indices->swap(this->remove_node_indices_);
112 }
113 } else {
114 found_match = false;
115 // Clear all bookkeeping data
116 match_->Clear();
117 match_.reset(nullptr);
118 node_label_to_index_.clear();
119 matched_node_indices_.clear();
120 remove_node_indices_.clear();
121 }
122 return found_match;
123}
124
125} // namespace utils
126} // namespace grappler

Callers 2

TEST_FFunction · 0.80

Calls 5

resetMethod · 0.45
getMethod · 0.45
swapMethod · 0.45
ClearMethod · 0.45
clearMethod · 0.45

Tested by 1

TEST_FFunction · 0.64