212 float defaultInitializer = DefaultInitializer(params.
m_PoolType);
213 Accumulator accumulate = GetAccumulator(params.
m_PoolType);
214 Executor execute = GetExecutor(params.
m_PoolType);
226 for (
int n = 0; n < batchSize; n++)
228 for (
int c = 0; c < channels; c++)
230 for (
int zOutput = 0; zOutput < depthOutput; zOutput++)
233 int dstart = (zOutput * strideZ) - padFront;
234 int dend = dstart + poolDepth;
237 dend = std::min(dend, depthInput + padBack);
239 int depth = dend - dstart;
240 bool dclamped = ClampRange(dstart, dend, depthInput);
241 int depthClamped = dend - dstart;
243 for (
int yOutput = 0; yOutput < heightOutput; yOutput++)
245 int hstart = (yOutput * strideY) - padTop;
246 int hend = hstart + poolHeight;
249 hend = std::min(hend, heightInput + padBottom);
251 int height = hend - hstart;
252 bool hclamped = ClampRange(hstart, hend, heightInput);
253 int heightClamped = hend - hstart;
255 for (
int xOutput = 0; xOutput < widthOutput; xOutput++)
257 int wstart = (xOutput * strideX) - padLeft;
258 int wend = wstart + poolWidth;
261 wend = std::min(wend, widthInput + padRight);
263 int width = wend - wstart;
264 bool wclamped = ClampRange(wstart, wend, widthInput);
265 int widthClamped = wend - wstart;
267 float result = defaultInitializer;
275 if (OnPaddingOnly(dstart, dend, depthInput) ||
276 OnPaddingOnly(hstart, hend, heightInput) ||
277 OnPaddingOnly(wstart, wend, widthInput))
281 int outputIndex = CalculateIndex(channels, depthOutput, heightOutput, widthOutput,
282 n, c, zOutput, yOutput, xOutput, dataLayout);
284 rOutputEncoder[
static_cast<unsigned int>(outputIndex)];
285 rOutputEncoder.
Set(result);
290 bool clamped = (dclamped | hclamped | wclamped);
299 for (
auto zInput = dstart; zInput < dend; zInput++)
301 for (
auto yInput = hstart; yInput < hend; yInput++)
303 for (
auto xInput = wstart; xInput < wend; xInput++)
306 int inputIndex = CalculateIndex(channels, depthInput, heightInput, widthInput,
307 n, c, zInput, yInput, xInput, dataLayout);
309 accumulate(result, decodedInputVec[
static_cast<unsigned int>(inputIndex)]);
314 execute(result, poolAreaSize);
316 int outputIndex = CalculateIndex(channels, depthOutput, heightOutput, widthOutput,
317 n, c, zOutput, yOutput, xOutput, dataLayout);
319 rOutputEncoder[
static_cast<unsigned int>(outputIndex)];
320 rOutputEncoder.
Set(result);