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);
60 Index in_index(input_shape.rank());
64 T result = std::numeric_limits<T>::lowest();
67 in_index.
at(0) = out_index.at(0);
68 in_index.
at(3) = out_index.at(3);
73 for (
int i = 0; i < num_spatial_dims; ++i)
75 out_index.at(1 + i) * strides[i] + window_index.at(i) - padding_before[i];
79 result = std::max(result, input.at(in_index));
83 res_accessor.
at(out_index) = result;
96 const auto &input_type = input.getType();
100 assert(input_type.isQuantized());
101 assert(output_type.isQuantized());
102 assert(input_type.getElementType() == DataType::UINT8);
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);
126 Index in_index(input_shape.rank());
131 in_index.
at(0) = out_index.at(0);
132 in_index.
at(3) = out_index.at(3);
138 for (
int i = 0; i < num_spatial_dims; ++i)
140 out_index.at(1 + i) * strides[i] + window_index.at(i) - padding_before[i];
144 result = std::max(result, input_accessor.
at(in_index));
147 res_accessor.
at(out_index) = result;