Closed axmat closed 2 years ago
From my side one question, If I want to init data as NHWC, how can I state my format? Or whether remain the (size + right stride) interface, if so, I don't have to change my code. Probably it's not important now, I can modify my other PR along this PR if your provide set format interface.
From my side one question, If I want to init data as NHWC, how can I state my format? Or whether remain the (size + right stride) interface, if so, I don't have to change my code. Probably it's not important now, I can modify my other PR along this PR if your provide set format interface.
You can permute the dimensions and create your memref using :
intptr_t sizes[4] = {n, h, w, c};
x MemRef<float,4> (sizes);
or you can keep the size in the nchw format and use the transpose function to permute the dimensions of the memref :
intptr_t sizes[4] = {n, c, h, w};
x MemRef<float,4>(sizes).transpose({0, 2, 3, 1});
I think it's better to get rid of the strides. By doing so we won't have to worry about the strides anymore and If there is an issue in the future we will only need to fix the container.
From my side one question, If I want to init data as NHWC, how can I state my format? Or whether remain the (size + right stride) interface, if so, I don't have to change my code. Probably it's not important now, I can modify my other PR along this PR if your provide set format interface.
You can permute the dimensions and create your memref using :
intptr_t sizes[4] = {n, h, w, c}; x MemRef<float,4> (sizes);
intptr_t sizes[4] = {n, c, h, w}; x MemRef<float,4>(sizes).transpose({0, 2, 3, 1});
I think it's better to get rid of the strides.
I see what's your mean, you can both init with NCHW or NHWC, and with transpose func to init the opposite one. To me LGTM.
Improves the memref descriptor and adds the ability to import PNG images using libpng.
Usage example: