MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / rep

Function rep

dnn/src/fallback/reduce/opr_impl.cpp:21–37  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

19void reduce_exec_C1(size_t A, size_t B, Op op) MEGDNN_NOEXCEPT {
20 using wtype = typename Op::wtype;
21 rep(a, A) {
22 std::function<wtype(size_t, size_t)> func;
23 func = [&func, B, &op, a](size_t bl, size_t br) -> wtype {
24 if (bl + 4096 < br) {
25 size_t mid = bl + (br - bl) / 2;
26 return op.apply(func(bl, mid), func(mid, br));
27 } else {
28 wtype res = op.INIT;
29 for (size_t b = bl; b < br; ++b) {
30 res = op.apply(res, op.read(a * B + b));
31 }
32 return res;
33 }
34 };
35 wtype res = func(0, B);
36 op.write(a, res);
37 }
38}
39
40template <typename Op>

Callers

nothing calls this directly

Calls 4

funcFunction · 0.50
applyMethod · 0.45
readMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected