@@ -261,14 +261,16 @@ GraphPatternDetector::DetectPatterns() {
261
261
return result;
262
262
}
263
263
264
- bool GraphItemCMP (const std::pair<PDNode *, Node *> &a,
264
+ struct GraphItemLessThan {
265
+ bool operator ()(const std::pair<PDNode *, Node *> &a,
265
266
const std::pair<PDNode *, Node *> &b) {
266
- if (a.first != b.first ) {
267
- return a.first < b.first ;
268
- } else {
269
- return a.second < b.second ;
267
+ if (a.first != b.first ) {
268
+ return a.first < b.first ;
269
+ } else {
270
+ return a.second < b.second ;
271
+ }
270
272
}
271
- }
273
+ };
272
274
273
275
// TODO(Superjomn) enhance the function as it marks unique unique as duplicates
274
276
// see https://github.com/PaddlePaddle/Paddle/issues/13550
@@ -282,7 +284,7 @@ void GraphPatternDetector::UniquePatterns(
282
284
for (auto &g : *subgraphs) {
283
285
// Sort the items in the sub-graph, and transform to a string key.
284
286
std::vector<std::pair<PDNode *, Node *>> sorted_keys (g.begin (), g.end ());
285
- std::sort (sorted_keys.begin (), sorted_keys.end (), GraphItemCMP );
287
+ std::sort (sorted_keys.begin (), sorted_keys.end (), GraphItemLessThan () );
286
288
std::stringstream ss;
287
289
for (auto &item : sorted_keys) {
288
290
ss << item.first << " :" << item.second ;
0 commit comments