MCPcopy Create free account
hub / github.com/alibaba/MNN / NCHW2NHWC

Function NCHW2NHWC

source/backend/cpu/CPUTensorConvert.cpp:19–33  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17
18template<typename T>
19void NCHW2NHWC(const T* source, T* dest, int b, int c, int area) {
20 int sourceBatchsize = c * area;
21 int destBatchSize = sourceBatchsize;
22 for (int bi = 0; bi < b; ++bi) {
23 auto srcBatch = source + bi * sourceBatchsize;
24 auto dstBatch = dest + bi * destBatchSize;
25 for (int i = 0; i < area; ++i) {
26 auto srcArea = srcBatch + i;
27 auto dstArea = dstBatch + i * c;
28 for (int ci = 0; ci < c; ++ci) {
29 dstArea[ci] = srcArea[ci * area];
30 }
31 }
32 }
33}
34
35template<typename T>
36void NHWC2NCHW(const T* source, T* dest, int b, int c, int area) {

Callers 1

convertMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected