Fix avg_pool count_include_pad argument guard - #80
Open
devin-lai wants to merge 1 commit into
Open
Conversation
Fixes apple#73. ATen omits trailing default arguments from exported nodes. When ceil_mode is true and count_include_pad remains at its default, the node contains exactly five arguments. The lowering guarded args[5] with a check for args[4], which caused an IndexError. Guard index 5 directly for both avg_pool2d and avg_pool3d while retaining the True default, and add end-to-end regression coverage for both operators.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #73.
torch.exportcan produce five-argument average-pool nodes whenceil_modeis set butcount_include_padremains at its default. The lowering checked argument 4 before reading argument 5, which caused anIndexError.This updates both the 2D and 3D lowerings to guard argument 5 directly and adds end-to-end coverage for the omitted default.
Tested with
pytest -q tests/ops/test_ops.py::test_avg_pool_defaults_count_include_pad_when_omitted.