fix(fx): drop the dynamic_range argument from the 8 remaining mark_as_int8_layer calls - #4651
Open
Anai-Guo wants to merge 1 commit into
Open
fix(fx): drop the dynamic_range argument from the 8 remaining mark_as_int8_layer calls#4651Anai-Guo wants to merge 1 commit into
Anai-Guo wants to merge 1 commit into
Conversation
…_int8_layer calls 13873bd ("remove dynamic_range in fx", pytorch#4221) changed mark_as_int8_layer(layer, dynamic_range) to mark_as_int8_layer(layer) and cleaned up 6 files, but 8 call sites across 5 files still pass two positional arguments and raise TypeError: mark_as_int8_layer() takes 1 positional argument but 2 were given on every quantized conversion that reaches them: add.py:47/64/70, batchnorm.py:21, linear.py:43/51, mul.py:46 and impl/convolution.py:130. linear.py:27, the one site pytorch#4221 did update, is the intended shape. Follows the same idiom as pytorch#4221: keep the call, drop the argument, and remove the get_dyn_range() computations and imports that become unused. get_dyn_range itself is kept -- quantization.py still uses it.
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.
Problem
13873bd "remove dynamic_range in fx" (#4221) changed
and cleaned up
adaptive_avgpool.py,impl/activation.py,maxpool.py,quantization.py,transformation.pyand one of the three sites inlinear.py. Eight call sites were missed and still pass two positionalarguments:
Replaying every
mark_as_int8_layer(...)call site infx/converters/againstthe signature parsed out of
converter_utils.pyonmain:Each one sits behind an
is_quantized/scale is not Noneguard, so it isreached by quantized
add,add_relu,mul,BatchNorm,LinearandConvconversion through the FX path.Fix
Same idiom #4221 used for
linear.py:27: keep the call, drop the argument.Where the argument was the only consumer of a
get_dyn_range(...)result, thecomputation and the now-unused import go too.
get_dyn_rangeitself is kept —quantization.pystill uses it.Note the two shapes #4221 dealt with: sites guarded by
if input_val.dynamic_range:were deleted whole (that attribute is gone in TRT 10), while sites guarded by
if is_quantized:kept the call. All eight sites here are the second kind, sonone of them are deleted.
Checks
black(26.3.1, the pinned pre-commit rev) reports all five files unchanged.pyflakesis clean on the patched files — the one remaining note,'typing.Any' imported but unusedinimpl/convolution.py, is pre-existing onmainand untouched here.🤖 Generated with Claude Code