Validate MaxpoolWithMask kernel rank matches input spatial rank
Merged
TI
4mo ago+75+75+01234567890123456789-0-0-0123456789
Description
MaxpoolWithMask::Compute now validates that the pooling kernel rank equals the input spatial rank (and that the rank is one of the supported values {1, 2, 3}) before allocating the output, returning a clear error for malformed inputs instead of proceeding with a mismatched configuration.
Changes
- Add an explicit check in
MaxpoolWithMask::Computethat the kernel rank matches the input spatial rank and is within the supported {1, 2, 3} range, with a descriptive error message. - DRY up the rank check.
- Add
MaxPoolWithMask_KernelRankMismatchandMaxPoolWithMask_KernelRankTooLargeunit tests covering the new validation.
Motivation
Improves input validation and error diagnostics for malformed MaxpoolWithMask inputs. CPU-only; no behavior change for valid inputs.
Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com