Stop getitem quantizer propagation on numel change - #4143
Open
tej-1916 wants to merge 1 commit into
Open
Conversation
tej-1916
force-pushed
the
fix/3109-getitem-quantizer-propagation
branch
from
July 18, 2026 00:24
b928096 to
3f5e844
Compare
tej-1916
force-pushed
the
fix/3109-getitem-quantizer-propagation
branch
from
July 18, 2026 00:25
3f5e844 to
7cd253e
Compare
tej-1916
marked this pull request as ready for review
July 18, 2026 00:30
Author
|
The implementation and focused regression tests are ready for review. CI workflows currently show action required; could a maintainer please approve the workflow runs when convenient? Thank you. |
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.
Summary
Fixes TorchFX quantizer propagation through
operator.getitemwhen the selected tensor has a different number of elements than the source tensor.Root cause
TorchFX graph conversion always classified
operator.getitemasPTGatherMetatype, and gather is quantization-agnostic. As a result, activation quantizers could propagate backward through split/getitem boundaries and land on the producer tensor even when downstream weighted ops consumed smaller selected tensors.Changes
operator.getitempreserves tensornumel.PTGatherMetatype.Validation
python -m pytest tests/torch/fx/test_quantizer_config.py -k "getitem_different_numel or getitem_same_numel" -vvpython -m pytest tests/torch/fx/test_quantizer_config.py -qpython -m pytest tests/torch/fx/test_models.py -k "yolo26 or yolo11n or split or getitem" -qpython -m ruff format --check src/nncf/common/graph/graph.py src/nncf/experimental/torch/fx/nncf_graph_builder.py src/nncf/quantization/algorithms/min_max/algorithm.py tests/torch/fx/test_quantizer_config.pypython -m ruff check src/nncf/common/graph/graph.py src/nncf/experimental/torch/fx/nncf_graph_builder.py src/nncf/quantization/algorithms/min_max/algorithm.py tests/torch/fx/test_quantizer_config.pygit diff --check