25 #include "depthwise_common.hpp"
34 std::tuple<size_t, size_t, size_t, size_t, size_t>
36 const size_t dilation_factor,
37 const size_t kernel_size,
const size_t stride,
38 const size_t orig_pad_before) {
40 out_size =
iceildiv(out_size - d, dilation_factor);
44 size_t start_pos = d * stride, pad_before = 0;
45 if (start_pos < orig_pad_before) {
46 pad_before =
iceildiv(orig_pad_before - start_pos, dilation_factor);
48 start_pos += pad_before * dilation_factor - orig_pad_before;
51 in_size = start_pos < in_size
52 ?
iceildiv(in_size - start_pos, dilation_factor)
56 const size_t reqd_input = (out_size - 1) * stride + kernel_size;
58 if (reqd_input > (pad_before + in_size)) {
59 pad_after = reqd_input - (pad_before + in_size);
62 return std::make_tuple(out_size, in_size, start_pos, pad_before, pad_after);