MCPcopy Create free account
hub / github.com/Oneflow-Inc/oneflow / DecideOrder

Function DecideOrder

oneflow/core/auto_parallel/algorithm_util.h:60–66  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

58// comp(v[order[i]], v[order[j]]) == true for all i<j.
59template<class T, class Compare>
60void DecideOrder(const T& v, std::vector<int32_t>& order, const Compare& comp) {
61 // Initialize order
62 order.resize(v.size());
63 for (int32_t i = 0; i < v.size(); i++) { order[i] = i; }
64 // sort
65 std::sort(order.begin(), order.end(), [&](int32_t i, int32_t j) { return comp(v[i], v[j]); });
66}
67
68// Inverse function of order
69// The reason why we need the inverse_order, a.k.a id2order, instead of id2value is to eliminate

Callers 4

NbhGreedyStrategyMethod · 0.85
GenerateNodeAndEdgeMethod · 0.85

Calls 5

compClass · 0.70
resizeMethod · 0.45
sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected