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

Function InternalFindUniqueNode

serving/processor/framework/graph_optimizer.cc:1047–1070  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1045}
1046
1047Node* InternalFindUniqueNode(Node* n) {
1048 std::unordered_set<Node*> pushed;
1049 std::queue<Node*> q;
1050 q.push(n);
1051 pushed.insert(n);
1052 while (!q.empty()) {
1053 Node* curr = q.front();
1054 q.pop();
1055 if (curr->op_def().name() == "Unique" ||
1056 curr->op_def().name() == "UniqueV2") {
1057 return curr;
1058 }
1059
1060 for (const Edge* edge : curr->in_edges()) {
1061 if (edge->IsControlEdge()) continue;
1062 if (pushed.find(edge->src()) == pushed.end()) {
1063 pushed.insert(edge->src());
1064 q.push(edge->src());
1065 }
1066 }
1067 }
1068
1069 return nullptr;
1070}
1071
1072Node* CheckUniqueNode(std::vector<Node*> gather_nodes) {
1073 Node* unique_node = nullptr;

Callers 1

CheckUniqueNodeFunction · 0.85

Calls 11

nameMethod · 0.65
pushMethod · 0.45
insertMethod · 0.45
emptyMethod · 0.45
frontMethod · 0.45
popMethod · 0.45
op_defMethod · 0.45
IsControlEdgeMethod · 0.45
findMethod · 0.45
srcMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected