MCPcopy Create free account
hub / github.com/OAID/Tengine / ref_reorg_common

Function ref_reorg_common

executor/operator/ref/kernel/reorg/ref_reorg_kernel.h:48–78  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

46typedef int (*ref_reorg_kernel_t)(const void* in_data, void* out_data, ref_reorg_param* param);
47
48static int ref_reorg_common(const char* in_data, char* out_data, ref_reorg_param* param, int element_size)
49{
50 int w = param->w;
51 int h = param->h;
52 int c = param->c;
53 int batch = param->batch;
54 int stride = param->stride;
55
56 int out_c = c / (stride * stride);
57
58 for(int b = 0; b < batch; ++b)
59 {
60 for(int k = 0; k < c; ++k)
61 {
62 for(int j = 0; j < h; ++j)
63 {
64 for(int i = 0; i < w; ++i)
65 {
66 int in_index = i + w * (j + h * (k + c * b));
67 int c2 = k % out_c;
68 int offset = k / out_c;
69 int w2 = i * stride + offset % stride;
70 int h2 = j * stride + offset / stride;
71 int out_index = w2 + w * stride * (h2 + h * stride * (c2 + out_c * b));
72 memcpy(out_data + in_index * element_size, in_data + out_index * element_size, element_size);
73 }
74 }
75 }
76 }
77 return 0;
78}
79
80#ifdef CONFIG_KERNEL_FP32
81#include "ref_reorg_fp32.c"

Callers 4

ref_reorg_uint8Function · 0.85
ref_reorg_int8Function · 0.85
ref_reorg_fp16Function · 0.85
ref_reorg_fp32Function · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected