| 966 | } |
| 967 | |
| 968 | Node* FindDynamicStitchNode(Node* gather_node) { |
| 969 | // Supported pattern: |
| 970 | // |
| 971 | // KvResourceGather |
| 972 | // | |
| 973 | // Identity |
| 974 | // | |
| 975 | // ... |
| 976 | // | |
| 977 | // Identity |
| 978 | // | |
| 979 | // ParallelDynamicStitch |
| 980 | // |
| 981 | if (gather_node->num_outputs() != 1) { |
| 982 | LOG(FATAL) << "Gather node has more than one edge, " |
| 983 | << gather_node->DebugString(); |
| 984 | } |
| 985 | |
| 986 | for (const Edge* edge : gather_node->out_edges()) { |
| 987 | Node* dest = edge->dst(); |
| 988 | while (dest->op_def().name() == "Identity") { |
| 989 | Node* tmp = nullptr; |
| 990 | for (const Edge* e : dest->out_edges()) { |
| 991 | tmp = e->dst(); |
| 992 | break; |
| 993 | } |
| 994 | dest = tmp; |
| 995 | } |
| 996 | |
| 997 | if (IsDynamicStitchOp(dest)) { |
| 998 | return dest; |
| 999 | } |
| 1000 | } |
| 1001 | |
| 1002 | return nullptr; |
| 1003 | } |
| 1004 | |
| 1005 | Node* CheckDynamicStitchNode(std::vector<Node*> gather_nodes) { |
| 1006 | Node* ds_node = nullptr; |
no test coverage detected