Repository navigation
Clarify multiple-inheritance op merge in TorchAOBaseTensor docstring - #4955
Open
PlatformLC wants to merge 1 commit into
Open
PlatformLC wants to merge 1 commit into
PlatformLC wants to merge 1 commit into
Conversation
PlatformLC
requested review from
andrewor14,
jerryzh168 and
vkuzo
as code owners
September 28, 2026 01:47
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/ao/4955
Note: Links to docs will display an error until the docs builds have been completed. This comment was automatically generated by Dr. CI and updates every 15 minutes. |
This branch has not been deployed
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
Clarify a self-contradictory sentence in the
TorchAOBaseTensordocstring aboutop inheritance under multiple inheritance. Docstring-only; no code or behavior change.
Problem
Current text:
The two clauses contradict each other: standard Python MRO gives the earlier
(leftmost) base priority, yet the sentence says the later base wins.
What the code actually does
__init_subclass__walkscls.__bases__in declaration order and merges eachparent's op table with
dict.update(see
torchao/utils.py, the__init_subclass__loop). A later-listed baseoverwrites an earlier one on conflicts, so the later base does take priority —
but this is a flat overwrite merge, not standard MRO resolution. The original
sentence jumped from the MRO premise straight to the conclusion, skipping the
overwrite step that bridges them.
Change
Reword to state the mechanism directly, keeping MRO as the visit-order premise and
removing the contradiction:
Notes
torchao/utils.pyonly; no functional change, no test impact.