39{
46 (void)padding_after;
47
49
50 constexpr int num_spatial_dims = 2;
51 assert(
input.getShape().rank() == 4);
52 assert(window_size.size() == num_spatial_dims);
53 assert(strides.size() == num_spatial_dims);
54 assert(padding_before.size() == num_spatial_dims);
55 assert(padding_after.size() == num_spatial_dims);
56
58
59 ShapeRange in_range(input_shape);
60 Index in_index(input_shape.rank());
61
63 {
64 T
result = std::numeric_limits<T>::lowest();
65
66
67 in_index.at(0) = out_index.at(0);
68 in_index.at(3) = out_index.at(3);
69
70 for (
const auto &window_index : ShapeRange(
Shape(window_size)))
71 {
72
73 for (int i = 0; i < num_spatial_dims; ++i)
74 in_index.at(1 + i) =
75 out_index.at(1 + i) * strides[i] + window_index.at(i) - padding_before[i];
76
77 if (in_range.contains(in_index))
78 {
80 }
81 }
82
83 res_accessor.at(out_index) =
result;
84 }
85}
const Shape & getInputShape(std::size_t index) const
const Shape & getOutputShape(std::size_t index) const
const std::vector< std::int32_t > & getPaddingBefore() const
const std::vector< std::int32_t > & getPaddingAfter() const
const std::vector< std::int32_t > & getWindowSize() const
const std::vector< std::int32_t > & getStrides() const
const luci_interpreter::RuntimeShape output_shape