docs/types(pt2e): annotate and document DuplicateDQPass (#4541) - #4565
Merged
andrewor14 merged 1 commit intoJul 22, 2026
Merged
Conversation
Type _maybe_duplicate_dq (the only untyped def) and drop the file-level # mypy: allow-untyped-defs, and add module/function/class docstrings. No behavior change. Part of the PT2E type-hint & docstring audit (pytorch#4541).
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/ao/4565
Note: Links to docs will display an error until the docs builds have been completed. ❗ 1 Active SEVsThere are 1 currently active SEVs. If your PR is affected, please view them below: ✅ No FailuresAs of commit 53bc23b with merge base bfbc842 ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
Contributor
|
@claude review please |
|
Claude finished @andrewor14's task in 37s —— View job Code Review:
|
andrewor14
approved these changes
Jul 21, 2026
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
Part of the PT2E type-hinting & docstring audit proposed in #4541. This PR
covers a single small, self-contained file:
torchao/quantization/pt2e/quantizer/duplicate_dq_pass.py.# mypy: allow-untyped-defs._maybe_duplicate_dq(...) -> None(it was theonly untyped def;
DuplicateDQPass.calland the nestedmaybe_replace_nodewere already annotated).
No behavior change — the executable lines are byte-for-byte identical; only the
mypy pragma, the one return annotation, and docstrings differ.
Why this is safe
allow-untyped-defsonly suppresses checking of untyped function bodies, socallwas already type-checked and passing. The only newly-checked body is_maybe_duplicate_dq, whose types are straightforward (GraphModule/Nodein,
Noneout); the existing# type: ignore[assignment]on theuser.args/user.kwargsrewrites is preserved.ruff checkpasses and no line exceeds 88 columns.🤖 Generated with Claude Code