﻿# ONNX Runtime 1.32 PadFusion: explicit zero can beat every negative pooling input

The 1.32 PadFusion repair preserves MaxPool zero-padding semantics; negative boundary windows are a stronger regression case than positive-only inputs.

Author: Retrivium team
Updated: 2026-11-15
Canonical URL: https://retrivium.ai/journal/week46-engine-ort-pad-maxpool-negative-semantics/
Language: en

ONNX Runtime 1.32.0 includes a PadFusion correction for MaxPool with negative inputs. The linked PR explains the semantic mismatch: explicit zero padding participates in the maximum, while implicit pooling padding is excluded. Removing a Pad node is therefore not automatically equivalent to increasing MaxPool padding by the same amount.

## Equal shapes can hide different functions

Both graphs can produce an output with the expected dimensions while disagreeing at a boundary window. A zero introduced as data can win over negative values; an excluded position cannot. This difference is numerical, not merely a layout detail. A proposed minimal test should isolate a boundary window with negative valid elements and compare optimized and unoptimized graphs, rather than checking only output shape or successful model initialization.

## Data range belongs in the proof

The PR restricts the affected fusion to a datatype where zero is the minimum representable value. That is a proof condition, not a claim that the operator is generally safe whenever observed calibration data happens to be positive. A runtime transformation must respect values allowed by the model contract. Tests should include signed and unsigned cases, with a Cast path where relevant, to prevent datatype assumptions from leaking across graph nodes.

## Padding geometry still needs checks

Upstream also guards invalid merged padding and shape effects involving ceil mode. Correct boundary values are only one part of equivalence; output extent must remain the same too. A useful regression matrix separates value cases from geometric cases, so a failure points to the violated condition. Include an unfused reference for each, rather than treating a surviving optimization node count as the principal acceptance criterion.

## A skipped fusion can be the correct optimization result

After the fix, some graphs should deliberately retain Pad. That is correctness-preserving behaviour, not evidence that optimization stopped working. Measure any performance tradeoff only after the result matches the source graph. The release reports this targeted semantic repair; this article adds no independent throughput result and does not infer that every Pad-to-Pool combination was previously wrong or is now eligible for fusion.

## Sources

- [ONNX Runtime v1.32.0 release](https://github.com/microsoft/onnxruntime/releases/tag/v1.32.0)
- [ONNX Runtime pull request #33206](https://github.com/microsoft/onnxruntime/pull/33206)

## Related reading

- [ONNX Runtime offline optimization: a saved optimized graph inherits a target contract](/journal/fg2-onnxruntime-offline-graph-target-compatibility/)
- [ONNX shape inference: unknown dimensions are not empty dimensions](/journal/fg2-onnx-shape-inference-symbolic-unknown-not-zero/)
