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

Method exec_internal

dnn/src/naive/repeat/opr_impl.cpp:11–27  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9
10template <typename T>
11void RepeatForwardImpl::exec_internal(
12 _megdnn_tensor_in src, _megdnn_tensor_out dst,
13 _megdnn_workspace /* workspace */) {
14 auto ndim = src.layout.ndim;
15 auto sptr = src.ptr<T>(), dptr = dst.ptr<T>();
16 auto sshape = src.layout.shape, dshape = dst.layout.shape;
17 auto tshape = param().times.shape;
18 size_t didx[TensorShape::MAX_NDIM];
19 std::memset(didx, 0, sizeof(didx));
20 do {
21 size_t sidx[TensorShape::MAX_NDIM];
22 rep(i, ndim) sidx[i] = didx[i] / tshape[i];
23 auto si = get_linear_addr(sidx, sshape, ndim);
24 auto di = get_linear_addr(didx, dshape, ndim);
25 dptr[di] = sptr[si];
26 } while (get_next_addr(didx, dshape, ndim));
27}
28
29void RepeatForwardImpl::exec(
30 _megdnn_tensor_in src, _megdnn_tensor_out dst, _megdnn_workspace workspace) {

Callers

nothing calls this directly

Calls 3

paramFunction · 0.50
repFunction · 0.50
total_nr_elemsMethod · 0.45

Tested by

no test coverage detected