95{
96 const auto &input_type =
input.getType();
98 (void)input_type;
99
100 assert(input_type.isQuantized());
102 assert(input_type.getElementType() == DataType::UINT8);
103
110 (void)padding_after;
111
112 constexpr int num_spatial_dims = 2;
113 assert(
input.getShape().rank() == 4);
114 assert(window_size.size() == num_spatial_dims);
115 assert(strides.size() == num_spatial_dims);
116 assert(padding_before.size() == num_spatial_dims);
117 assert(padding_after.size() == num_spatial_dims);
118
120
122 TensorVariant res(res_type);
124
125 ShapeRange in_range(input_shape);
126 Index in_index(input_shape.rank());
127
129 {
130
131 in_index.at(0) = out_index.at(0);
132 in_index.at(3) = out_index.at(3);
133
135 for (
const auto &window_index : ShapeRange(
Shape(window_size)))
136 {
137
138 for (int i = 0; i < num_spatial_dims; ++i)
139 in_index.at(1 + i) =
140 out_index.at(1 + i) * strides[i] + window_index.at(i) - padding_before[i];
141
142 if (in_range.contains(in_index))
143 {
144 result = std::max(result, input_accessor.at(in_index));
145 }
146 }
147 res_accessor.at(out_index) =
result;
148 }
149}
const TensorType & getType() const
Gets the type of this output.
Output * getOutput(std::size_t index)
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