42 const auto width_out =
static_cast<int>(
dst_shape[0]);
43 const auto height_out =
static_cast<int>(
dst_shape[1]);
44 const auto channel_out =
static_cast<int>(
dst_shape[2]);
46 const auto width_in =
static_cast<int>(
src.shape()[0]);
47 const auto height_in =
static_cast<int>(
src.shape()[1]);
48 const auto channel_in =
static_cast<int>(
src.shape()[2]);
50 const auto batch =
static_cast<int>(
src.shape()[3]);
52 const auto block_width = block_shape;
53 const auto block_height = block_shape;
56 for(
int ba = 0; ba < batch; ++ba)
58 for(
int outC = 0; outC < channel_out; ++outC)
60 unsigned int inC = outC % channel_in;
62 int shift_w = (outC / channel_in) % block_width;
63 int shift_h = (outC / channel_in) / block_width;
65 for(
int outH = 0; outH < height_out; ++outH)
67 for(
int outW = 0; outW < width_out; ++outW)
69 const auto in_pos = ((ba * channel_in + inC) * height_in + ((outH * block_height + shift_h))) * width_in + (outW * block_width + shift_w);
70 result[out_pos] =
src[in_pos];