Skip to content

fix: Correct padding for NCHW quantized AVG pooling - #1319

Open
vera-rubin wants to merge 1 commit into
ARM-software:mainfrom
vera-rubin:fix/quantized-avg-padding
Open

vera-rubin wants to merge 1 commit into
ARM-software:mainfrom
vera-rubin:fix/quantized-avg-padding

Conversation

@vera-rubin

Copy link
Copy Markdown

NCHW quantized AVG pooling uses raw code zero for included padding. With a 2×2 QASYMM8 input filled with code 128, scale 0.25 and zero point 128, a 2×2 pool with stride 1 and padding 1 produces corners of 32 and edges of 64. The documented zero padding should leave every output at 128.

We use the input zero point for included padding in the 2×2, 3×3 and general kernels, while omitting samples beyond explicit padding in partial CEIL windows.

We tested the reproducer, 72 regression cases covering signed and unsigned quantization, and the existing pooling suite.

— ChipLab

With included padding, a 2x2 QASYMM8 input filled with its zero point
of 128 produces corner values of 32 instead of 128. The NCHW kernels
sum stored codes but use raw zero for padding.

Use the input zero point for included AVG padding in the 2x2, 3x3 and
general kernels. Keep samples beyond explicit padding out of partial
CEIL windows, since the averaging divisor excludes those samples.

Add coverage for signed and unsigned quantization, equal and differing
output quantization, both padding modes, and partial vector windows.

Signed-off-by: Nathan Chandrasekar <322284620+vera-rubin@users.noreply.github.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant