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

Function tile_or_repeat_single_axis

dnn/src/common/tile_repeat_helper.cpp:10–27  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8// Tile (m, n) to (m, n*times) or Repeat (m, n) to (m*times, n)
9template <typename T>
10void tile_or_repeat_single_axis(
11 const T* __restrict src, T* __restrict dst, const size_t m, const size_t n,
12 const size_t times) {
13 rep(i, m) {
14 // copy Ts of length n to dst
15 std::memcpy(dst, src, sizeof(T) * n);
16 size_t k = 1u;
17 while (k * 2 <= times) {
18 std::memcpy(dst + k * n, dst, sizeof(T) * (k * n));
19 k *= 2;
20 }
21 if (k < times) {
22 std::memcpy(dst + k * n, dst, sizeof(T) * (times - k) * n);
23 }
24 src += n;
25 dst += n * times;
26 }
27}
28
29template <typename T>
30void init_tile_repeat_state(

Callers 2

execMethod · 0.85
execMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected