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 batch_out =
static_cast<int>(
dst_shape[3]);
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 batch_in =
static_cast<int>(
src.shape()[3]);
50 const auto channel =
static_cast<int>(
src.shape()[2]);
52 const auto block_width = block_shape[0];
53 const auto block_height = block_shape[1];
55 const auto padding_left = paddings[0];
56 const auto padding_top = paddings[2];
62 for(
int outB = 0; outB < batch_out; ++outB)
64 unsigned int inB = outB % batch_in;
66 int shift_w = (outB / batch_in) % block_width;
67 int shift_h = (outB / batch_in) / block_width;
69 for(
int c = 0; c < channel; ++c)
71 for(
int outH = 0; outH < height_out; ++outH)
73 for(
int outW = 0; outW < width_out; ++outW)
75 const auto in_pos = ((inB * channel + c) * height_in + ((outH * block_height + shift_h) - padding_top)) * width_in + (outW * block_width + shift_w) - padding_left;
77 if(outH * block_height + shift_h < padding_top || outH * block_height + shift_h >= padding_top + height_in || outW * block_width + shift_w < padding_left
78 || outW * block_width + shift_w >= padding_left + width_in)
80 result[out_pos] = pad_value;
84 result[out_pos] =
src[in_pos];