41{
42 for (uint32_t out_ch = 0; out_ch < out_shape.
depth(); ++out_ch)
43 {
44 for (uint32_t out_row = 0; out_row < out_shape.
height(); ++out_row)
45 {
46 for (uint32_t out_col = 0; out_col < out_shape.
width(); ++out_col)
47 {
48 OutputDType out_value = 0;
49
50 for (uint32_t ker_ch = 0; ker_ch < ker_shape.
depth(); ++ker_ch)
51 {
52 for (uint32_t ker_row = 0; ker_row < ker_shape.
height(); ++ker_row)
53 {
54 for (uint32_t ker_col = 0; ker_col < ker_shape.
width(); ++ker_col)
55 {
56 const int64_t vertical_stride =
static_cast<int64_t
>(stride_info.
vertical());
57 const int64_t horizontal_stride =
static_cast<int64_t
>(stride_info.
horizontal());
58 const int64_t top_padding =
static_cast<int64_t
>(pad_info.
top());
59 const int64_t left_padding =
static_cast<int64_t
>(pad_info.
left());
60
61 const uint32_t in_ch = ker_ch;
62 const int64_t in_row = vertical_stride * out_row - top_padding + ker_row;
63 const int64_t in_col = horizontal_stride * out_col - left_padding + ker_col;
64
65 const bool is_padding = (in_row < 0) || (in_row >= in_shape.
height()) ||
66 (in_col < 0) || (in_col >= in_shape.
width());
67
68 const auto in_value = (is_padding) ? 0
69 : in_data.at(in_ch, static_cast<uint32_t>(in_row),
70 static_cast<uint32_t>(in_col));
71
72 const auto ker_value = ker_data.
at(out_ch, in_ch, ker_row, ker_col);
73
74 out_value += in_value * ker_value;
75 }
76 }
77 }
78
79 out_data.
at(out_ch, out_row, out_col) = out_value;
80 }
81 }
82 }
83}
uint32_t depth(void) const
uint32_t width(void) const
uint32_t height(void) const
uint32_t width(void) const
uint32_t height(void) const
uint32_t depth(void) const
uint32_t left(void) const
uint32_t vertical(void) const
uint32_t horizontal(void) const
virtual T & at(uint32_t ch, uint32_t row, uint32_t col)=0
virtual T at(uint32_t nth, uint32_t ch, uint32_t row, uint32_t col) const =0